Reputation: 1751
docker ps
or docker container ls
returns an overview of all running containers. The meaning of all columns is clear to me, except one. What does the column 'COMMAND' mean?
Upvotes: 3
Views: 13721
Reputation: 3480
This is the command which is passed to the container.
$ docker run -d busybox top
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3eca7c034b21 busybox "top" 6 seconds ago Up 5 seconds recursing_dirac
If you check above, top is the command which has been passed to the busybox container and that's what it's showing in the docker ps -a
.
Upvotes: 4
Reputation: 361547
It's the command passed to docker run <image> [command]
.
$ docker run -d ubuntu sleep 60
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
f0c9cd92a938 ubuntu "sleep 60" 3 seconds ago Up 1 second
If no command was specified there then it's the CMD
from the Dockerfile. In ubuntu
's case that would be CMD ["/bin/bash"]
:
$ docker run -di ubuntu
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS
9cd752ee86f4 ubuntu "/bin/bash" 4 seconds ago Up 2 seconds
Upvotes: 2