Reputation: 316
Anyone who works with Docker regularly is familiar with the common commands docker ps
and docker ps -a
.
I know that docker ps
lists all running containers in the Docker engine, but what does the "ps" actually mean?
I also know that docker ps -a
has the effect of also listing containers that have stopped, but what does the -a
actually mean?
Upvotes: 15
Views: 14957
Reputation: 20185
The command docker ps
was created based on unix's ps
command. Here, ps
is an abbreviation for "process status".
Translated to docker, docker ps
lists containers. Executing docker ps
lists all running containers, while executing docker ps -a
(or docker ps --all
) lists all containers.
Upvotes: 3
Reputation: 2963
docker ps
= docker container list
= docker container ls
All commands above are aliases.
The command docker ps
is very useful. For example:
docker container kill $(docker ps -q)
— Kill all running containers.
docker container rm $(docker ps -a -q)
— Delete all not running containers.
Upvotes: 2
Reputation: 9596
ps
means “Process Status”, so docker ps
basically shows all of the Docker processes actively running.
docker ps
lists all containers that are up and running.
-a
means all (both stopped and running) containers.
Upvotes: 4
Reputation: 311
-a
is short form for the --all
. option This option will show all the containers both stopped and running.
ps
is an abbreviation for "process status". Normally, docker ps
only shows the running containers, but adding the -a
option causes it to show all containers.
You can find more details in the Docker "ps" options documentation.
Upvotes: 19