Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of "docker ps -a"?

Tags:

docker

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?

like image 342
JT_T Avatar asked Nov 15 '19 02:11

JT_T


People also ask

What is docker ps all?

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.

What is the difference between docker ps and docker ps?

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.

What is command in docker ps output?

The docker ps command is used to show you the running containers on your current Docker host. It gives you information like: Container ID.

What is P option in docker?

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.


Video Answer


3 Answers

-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.

like image 81
Gokul Garre Avatar answered Oct 19 '22 19:10

Gokul Garre


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.

like image 32
M Komaei Avatar answered Oct 19 '22 18:10

M Komaei


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.

like image 2
mrvol Avatar answered Oct 19 '22 19:10

mrvol