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
Syntax
docker ps [OPTIONS]
Parameters
| Parameter | Description |
|---|---|
-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
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.
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.
Related
docker run· Create and start a container from an image, with options for ports, environment, volumes, names and cleanup.docker inspect· Show the low-level JSON configuration and state of containers, images, volumes or networks; extract fields with --format.- Running Containers · tutorial