Skip to content
LatchkeyLatchkey home

docker ps: List Containers, Filters & Formatting

List containers - running by default, all of them with -a.

docker ps (alias docker container ls) lists containers. This page covers showing stopped containers, filtering, formatting, and reading exit codes.

What it does

docker ps lists running containers by default. With -a it includes stopped and exited containers, which is essential for debugging why a container died in CI.

Common usage

Terminal
docker ps
docker ps -a
docker ps --filter "status=exited"
docker ps -a --format "{{.Names}} {{.Status}}"
docker ps -q                          # IDs only (scripting)

Common errors in CI

A common CI confusion is "my container is gone" - by default docker ps hides exited containers; add -a to see one that crashed, then docker logs it. The Status column shows "Exited (137)" for an OOM-killed container and "Exited (1)" for an app error. Use docker ps -aq to feed IDs into cleanup commands like docker rm.

Frequently asked questions

docker ps: List Containers, Filters & Formatting?
docker ps (alias docker container ls) lists containers. This page covers showing stopped containers, filtering, formatting, and reading exit codes.
What it does?
docker ps lists running containers by default. With -a it includes stopped and exited containers, which is essential for debugging why a container died in CI.
Common errors in CI?
A common CI confusion is "my container is gone" - by default docker ps hides exited containers; add -a to see one that crashed, then docker logs it. The Status column shows "Exited (137)" for an OOM-killed container and "Exited (1)" for an app error. Use docker ps -aq to feed IDs into cleanup commands like docker rm.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card