Challenge - 5 Problems
Log Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Viewing logs of a running container
You have a Docker container named
webapp running. Which command shows the logs of this container?Attempts:
2 left
💡 Hint
The command to see logs starts with
docker logs.✗ Incorrect
The correct command to view logs of a container is
docker logs [container_name]. Other options are invalid commands.💻 Command Output
intermediate2:00remaining
Viewing real-time logs with follow option
You want to see live logs from a container named
db as they are generated. Which command will do this?Attempts:
2 left
💡 Hint
The option to follow logs live is a single letter.
✗ Incorrect
The
-f or --follow option streams logs live. Other options are invalid or do not stream logs.❓ Configuration
advanced2:00remaining
Limiting log output to recent lines
You want to see only the last 50 lines of logs from a container named
api-server. Which command achieves this?Attempts:
2 left
💡 Hint
The option to limit lines is
--tail.✗ Incorrect
The
--tail option followed by a number shows that many recent lines. Other options are invalid or do not exist.❓ Troubleshoot
advanced2:00remaining
Error when viewing logs of a stopped container
You run
docker logs myapp but get the error: Error: No such container: myapp. What is the most likely cause?Attempts:
2 left
💡 Hint
Check if the container is listed with
docker ps -a.✗ Incorrect
The error means Docker cannot find a container named
myapp. It may have been removed or never created. The -f option or -a do not fix this error.✅ Best Practice
expert3:00remaining
Efficiently managing large container logs
Your container produces very large logs. Which approach is best to avoid filling disk space while still being able to view recent logs?
Attempts:
2 left
💡 Hint
Docker supports built-in log rotation settings.
✗ Incorrect
Setting a logging driver with rotation and size limits prevents disk from filling up automatically. Manual deletion or stopping containers is inefficient and risky. Using
--tail limits output but does not reduce log file size.