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?
The docker ps command only shows running containers by default. To see all containers, use the -a (or --all ) flag: $ docker ps -a. docker ps groups exposed ports into a single range if possible. E.g., a container that exposes TCP ports 100, 101, 102 displays 100-102/tcp in the PORTS column.
There is no difference between the docker ps (docker process status) and docker container ls (docker container list) commands in terms of functionality. They even allow the same set of flags. The only real difference between the two is the fact that the latter is newer and more verbose than the former.
The docker ps command is used to show you the running containers on your current Docker host. It gives you information like: Container ID.
If the operator uses -P (or -p) then Docker will make the exposed port accessible on the host and the ports will be available to any client that can reach the host.
-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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With