# docker ps: List Containers, Filters & Formatting

> How docker ps works: listing running and stopped containers, filters, format strings, and reading exit status to debug CI.

Source: https://latchkey.dev/learn/command-reference/docker-ps-command  
Updated: 2026-06-25

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.

## FAQ

### 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
