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
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.
Frequently asked questions
docker compose logs Command Reference?
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.
In 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.