docker compose logs Command Reference
View aggregated output from compose services.
docker compose logs prints the combined logs of all services in a project, prefixed by service name. In CI it is the diagnostic dump for a stack that failed to come up or a test that could not reach a dependency.
Common flags
--tail- limit to the last N lines per service, e.g. --tail 100-f, --follow- stream output (avoid in foreground CI steps)--no-color- plain output, easier to read in CI logs-t, --timestamps- prefix lines with timestamps- Positional service names limit output to those services
Example
shell
docker compose logs --no-color --tail 200 --timestampsIn CI
Add docker compose logs --no-color --tail 200 in an always() step so a failing stack leaves readable diagnostics. --no-color avoids ANSI escape noise in plaintext CI logs. Do not use -f in a normal step; it never returns.
Key takeaways
- --no-color and --tail produce readable, bounded CI output.
- Dump logs in an always() step to debug stack startup failures.
- Avoid -f in foreground steps; it blocks indefinitely.
Related guides
docker compose up Command ReferenceReference for docker compose up in CI: start services from a compose file with -d, --build, and --wait so dep…
docker compose ps Command ReferenceReference for docker compose ps in CI: list the status of project services with -a, --format, and --status to…
docker logs Command ReferenceReference for docker logs in CI: fetch container stdout and stderr with --tail, --since, --timestamps, and -f…