Introduction
This article has a relation which can be a continuation from the previous article. In that article, there is already a way by executing command to list docker container. That article is an article with the title of ‘How to list docker container‘ which exist in this link. It is only displaying a list of docker container without any filter at all. On the other hand, this article will try to add the information on that. So, in relation with the docker container, this will not only display the docker container but specifically, it will list all of it. Moreover, it also going to list docker container using another command besides ‘docker ps’.
List All Docker Container
This is the part where it will show how to list all docker container. The following is the command for listing the container in the previous article :
C:\Users\Administrator>docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8a52dcce139c registry "/entrypoint.sh /etc…" 4 days ago Up 15 hours 0.0.0.0:5000->5000/tcp hub.local 8bca4865ac83 centos "/bin/bash" 4 days ago Up 12 hours centos_sinergi C:\Users\Administrator>
The above output is can be available with a different command. In this context, the different command for producing the same output as in the above one is in the following command execution :
docker container list CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8a52dcce139c registry "/entrypoint.sh /etc…" 4 days ago Up 15 hours 0.0.0.0:5000->5000/tcp hub.local 8bca4865ac83 centos "/bin/bash" 4 days ago Up 12 hours centos_sinergi C:\Users\Administrator>
Another one is the parameter for the commmand.
C:\Users\Administrator>docker container list --all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3ca3c24f657d 0f55 "bash" 11 hours ago Exited (127) 11 hours ago blissful_ellis 2cfce8343dcf 0f55 "/bin/bash" 4 days ago Exited (0) 10 hours ago vigilant_grothendieck 8a52dcce139c registry "/entrypoint.sh /etc…" 4 days ago Up 16 hours 0.0.0.0:5000->5000/tcp hub.local 8bca4865ac83 centos "/bin/bash" 5 days ago Up 12 hours centos_sinergi C:\Users\Administrator>
So, the additional parameter of ‘–all’ is showing not only the running container but also all of the containers available including the one which is already stop. That parameter is also working with the ‘docker ps’ command as follows :
C:\Users\Administrator>docker ps --all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3ca3c24f657d 0f55 "bash" 11 hours ago Exited (127) 11 hours ago blissful_ellis 2cfce8343dcf 0f55 "/bin/bash" 4 days ago Exited (0) 10 hours ago vigilant_grothendieck 8a52dcce139c registry "/entrypoint.sh /etc…" 4 days ago Up 16 hours 0.0.0.0:5000->5000/tcp hub.local 8bca4865ac83 centos "/bin/bash" 5 days ago Up 12 hours centos_sinergi C:\Users\Administrator>