Home·Terminal commands

docker ps

Packages and runtimes

Usage

docker ps [-a] [--filter <f>]

Lists only the containers running right now; one that exited straight after start is invisible until -a, which is where to look when docker run seems to have done nothing.

Common flags

FlagMeaning
-astopped containers too
-qids only, for piping
--filter status=exitednarrow by status, name, label and so on
--format "{{.Names}} {{.Status}}"choose the columns
-n <n>the n most recently created
-sshow the disk each one uses

Examples

docker ps

the containers running right now

docker ps -a

also the ones that exited, which is where a crash shows up

docker ps -q | xargs docker stop

stops everything that is running

The question is always what goes where: inside this project, or on the whole machine.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does docker ps do?

Lists only the containers running right now; one that exited straight after start is invisible until -a, which is where to look when docker run seems to have done nothing.

Q. How do I type it?

docker ps [-a] [--filter <f>] — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

6 are listed here; the full set is in man docker. This command sits under Packages and runtimes.

Related commands

man page: man docker-ps