docker ps
List containers. By default shows only running containers.
Syntax
docker ps [OPTIONS]
Examples
Example 1
docker ps
List running containers.
Example 2
docker ps -a
List all containers including stopped.
Example 3
docker ps --format 'table {{.Names}} {{.Status}} {{.Ports}}'Custom format with names, status, and ports.
Common flags
| Flag | Description |
|---|---|
| -a, --all | Show all containers |
| -q, --quiet | Show only container IDs |
| -s, --size | Display file sizes |
| --format | Custom output format |
Tips & best practices
- •Use -a to find stopped containers before removing.
- •Format strings use Go template syntax.