Skip to content
Latchkey

docker compose ps Command Reference

List the containers for a compose project.

docker compose ps shows the services in the current project with their state, ports, and health. In CI it confirms the stack is up before running tests and surfaces which service crashed when something went wrong.

Common flags

  • -a, --all - include stopped service containers
  • -q, --quiet - output only container IDs
  • --format - output style, e.g. json for scripting
  • --status - filter by status, e.g. running or exited
  • --services - list service names only

Example

shell
docker compose ps --format json
docker compose ps --status exited --services

In CI

Use docker compose ps --format json and parse it to assert every expected service is running and healthy before integration tests. --status exited quickly identifies a service that crashed during startup so the job can fail fast with a clear cause.

Key takeaways

  • --format json makes the service state machine-parseable for assertions.
  • --status exited surfaces a crashed service immediately.
  • Use it as a readiness check before running integration tests.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →