- Beginner
- Running containers
How it works
docker logs api prints the log, --tail 50 the last lines, -f follows it live and --since 10m filters by time. Logs survive a stop but not docker rm. With Compose, docker compose logs shows every service, each line prefixed by its name.
What breaks
An app that writes to a file inside the container hides its errors from docker logs and fills its writable layer: log to stdout. And the default json-file driver keeps everything; without max-size, a chatty container can fill the disk.
In a terminal
docker logs --tail 50 api
docker logs -f --since 10m api
See it break, then fix it
Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.