Docker helps in making the process of application deployment very easy and efficient. It resolves a lot of issues related to deploying the applications. In this article, we are going to see how to list Containers in Docker.
There are various commands when it comes to listing Docker‘s different status of containers. But there are 7 commands which everyone should know if they are using Docker Containers. Let’s see one by one commands below.
Here is the List
1] List Running Containers
To list all running Containers we use docker ps command.
2] List Latest Created Container
To list container which just has been created we use docker ps -l command.
3] List all Containers
To list all the available containers we use docker ps -a command.
4] List Last Created Container
To list the last created Container we use docker ps -n=-1 command.
5] Remove NOT running Containers
To remove all NOT running containers we use docker rm `docker ps -aq -f status=exited` command.
6] List Size of Running Containers
To list the size of all running containers we use ps -s command.
7] List Stopped Containers
To list all stopped Docker containers we use docker ps --filter "status=exited" command.
All of the above are some important commands you would need when you are using Docker Containers. Try to use Docker on Azure Cloud and use above commands.