Docker Engine 29 reference · Containers

docker ps Command (Docker CLI)

List containers: running ones by default, all with -a, filtered and formatted for scripts with --filter and --format.

Docker Engine 29

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

docker ps [OPTIONS]

Parameters

ParameterDescription
-a Show all containers, including stopped ones.
--filter KEY=VALUE Filter by name, label, status, ancestor and more.
--format TEMPLATE Format output with a Go template, e.g. '{{.Names}}'.
-q Only print container IDs.

Examples

A formatted table
docker run -d --name rc-ref-ps alpine:3.24 sleep 300 > /dev/null
docker ps --filter name=rc-ref-ps --format 'table {{.Names}}\t{{.Image}}\t{{.State}}'
docker rm -f rc-ref-ps > /dev/null

Output

NAMES       IMAGE         STATE
rc-ref-ps   alpine:3.24   running

Run this on your computer — see “Get Started” for setup.

Stopped containers need -a
docker run --name rc-ref-done alpine:3.24 true
echo "running with that name: $(docker ps -q --filter name=rc-ref-done | wc -l)"
echo "all (incl. stopped): $(docker ps -aq --filter name=rc-ref-done | wc -l)"
docker rm rc-ref-done > /dev/null

Output

running with that name: 0
all (incl. stopped): 1

Run this on your computer — see “Get Started” for setup.

Was this page helpful?