LinuxCommandLibrary

docker-ps

list Docker containers and their status

TLDR

List running containers

$ docker ps
copy
List all containers (including stopped)
$ docker ps -a
copy
List with custom format
$ docker ps --format "{{.ID}}: {{.Names}}"
copy
List only container IDs
$ docker ps -q
copy
List containers by name filter
$ docker ps -f name=[pattern]
copy
List containers by status
$ docker ps -f status=[running|exited|paused]
copy
Show container sizes
$ docker ps -s
copy
List last created container
$ docker ps -l
copy

SYNOPSIS

docker ps [options]

DESCRIPTION

docker ps lists Docker containers. By default, it shows only running containers with their ID, image, command, creation time, status, ports, and names.
The command provides filtering capabilities to find specific containers by various criteria. Custom formatting allows displaying exactly the information needed, useful for scripting and automation.
Container IDs are shown truncated by default; use --no-trunc for full IDs. The -q option outputs only IDs, convenient for passing to other commands.

PARAMETERS

-a, --all

Show all containers (default shows running only).
-q, --quiet
Only display container IDs.
-l, --latest
Show latest created container.
-n num
Show n last created containers.
-s, --size
Display total file sizes.
-f, --filter filter
Filter output based on conditions.
--format string
Format output using Go template.
--no-trunc
Don't truncate output.

FILTERS

id: Container ID
name: Container name
label: Label key or key=value
status: created, restarting, running, paused, exited, dead
ancestor: Image name or ID
network: Network name or ID
publish / expose: Port number
health: healthy, unhealthy, starting, none

FORMAT PLACEHOLDERS

{{.ID}}: Container ID
{{.Names}}: Container names
{{.Image}}: Image name
{{.Status}}: Container status
{{.Ports}}: Published ports
{{.State}}: Container state
{{.CreatedAt}}: Creation time
{{.RunningFor}}: Time since start

CAVEATS

Stopped containers are hidden by default; use -a to see them. Size calculation (-s) can be slow on systems with many containers. Format strings use Go template syntax. Some filters may behave unexpectedly with wildcards.

HISTORY

docker ps has been part of Docker since its initial release in 2013, modeled after the Unix ps command for processes. The filtering and formatting options were added over time to support container management at scale. The command remains the primary way to inspect running containers.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community