0
0
Dockerdevops~20 mins

Docker logs for troubleshooting - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Logs Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Identify the output of a Docker logs command
You run the command docker logs myapp on a container named myapp. What will you see if the container has just started and printed Hello World once?
ANo output, the command waits indefinitely
BError: No such container: myapp
CContainer myapp is running
DHello World
Attempts:
2 left
💡 Hint
Think about what docker logs shows from the container's output.
🧠 Conceptual
intermediate
1:30remaining
Understanding Docker logs options
Which docker logs option allows you to continuously stream new log output as it is generated?
A--since
B--tail
C--follow
D--timestamps
Attempts:
2 left
💡 Hint
This option is like watching a live feed of logs.
Troubleshoot
advanced
2:00remaining
Diagnosing missing logs from a container
You run docker logs myservice but see no output, even though the container is running and should produce logs. What is the most likely cause?
AThe container was started with <code>--log-driver=none</code>
BThe container has crashed and stopped
CYou need to restart the Docker daemon
DThe container logs are stored in a different directory
Attempts:
2 left
💡 Hint
Think about Docker's logging drivers and how they affect log availability.
🔀 Workflow
advanced
2:30remaining
Steps to troubleshoot a failing container using logs
Arrange the steps in the correct order to troubleshoot a container that fails immediately after starting using Docker logs.
A1,3,2,4
B1,2,3,4
C3,1,2,4
D2,1,3,4
Attempts:
2 left
💡 Hint
Start by checking if the container is running before looking at logs.
Best Practice
expert
3:00remaining
Choosing the best logging driver for troubleshooting
You want to ensure your Docker containers' logs are easily accessible and include timestamps for troubleshooting. Which logging driver and option combination is best?
AUse the <code>json-file</code> logging driver with <code>--log-opt timestamps=true</code>
BUse the <code>none</code> logging driver to avoid log overhead
CUse the <code>syslog</code> logging driver without timestamps
DUse the <code>journald</code> logging driver with no extra options
Attempts:
2 left
💡 Hint
Consider default drivers and how to add timestamps.