Show the Logs of a Project
Run the command in the folder that holds the Compose file:
docker compose logs
docker compose logs web
docker compose logs web workerWithout a service name you get every service, interleaved, each line starting with the container name in its own color. The command prints everything stored so far and exits. What it shows is the standard output and standard error of each container's main process.
Follow New Lines
docker compose logs -f
docker compose logs -f --tail 50 web-f keeps the command running and prints new lines as they arrive. Ctrl+C stops following; the containers keep running. Combine it with --tail so you do not scroll through days of old output first.
Limit by Count and Time
| Option | Shows |
|---|---|
--tail 100 | Last 100 lines each |
--since 30m | The last 30 minutes |
--since 2h | The last two hours |
--until 10m | Up to 10 minutes ago |
-t | Adds timestamps |
--tail counts per container, not in total. --since and --until also take a date and time such as 2026-11-30T09:00:00, read in the local time zone unless you add Z or an offset, which narrows the output to the minutes around an incident:
docker compose logs -t --since 2026-11-30T09:00:00 --until 2026-11-30T09:15:00 webClean Output for grep and Files
docker compose logs --no-color web 2>&1 | grep -i error
docker compose logs --no-color --no-log-prefix web > web.log--no-color drops the color codes that clutter files, and --no-log-prefix drops the container name, so each line is exactly what the application printed.
Logs of Stopped Containers
The output of a container is kept as long as the container exists. A service that crashed or was stopped still shows its last lines, which is often where the reason is. docker compose ps -a lists such containers. docker compose down removes the containers, and their logs go with them, so read the output before you tear a failing project down. For a single container outside Compose, use docker logs.
Where the Logs Are Stored
With the default json-file logging driver, Docker writes one file per container under /var/lib/docker/containers/. Find the exact file with docker inspect --format '{{.LogPath}}' CONTAINER. These files have no size limit unless you set one, and a chatty service can fill the disk; see how to check disk space in Linux.
Limit the Log Size
services:
web:
image: nginx:alpine
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"This keeps at most three files of 10 MB for the service. The setting applies to containers created after the change, so run docker compose up -d to recreate them. To set a limit for every container on the server, put log-driver and log-opts in /etc/docker/daemon.json, with the values written as strings. Check the file with sudo dockerd --validate --config-file=/etc/docker/daemon.json, which prints "configuration OK" (an error here would keep Docker from starting), then restart Docker at a quiet moment, because it stops running containers unless live restore is enabled, and only those with a restart policy start again. Existing containers keep their old settings until they are recreated.
Nothing Appears
- The application writes to a file: output written to a log file inside the container never reaches docker compose logs. Configure the application to log to standard output, or link its log files to
/dev/stdoutand/dev/stderr, as the official nginx image does. Meanwhile read the file withdocker compose exec web tail -f /var/log/app/app.log; see docker exec. - Another logging driver: when a service sends its logs elsewhere, Docker normally keeps a local cache copy for reading, but not if that cache was switched off with
cache-disabled.docker info --format '{{.LoggingDriver}}'shows the server's default. - Wrong folder or project: the command shows only the project of the current folder. Name the project or the file before the subcommand, as in
docker compose -p NAME logsordocker compose -f /srv/shop/compose.yaml logs; afterlogs,-fmeans follow.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations