In this article, I will create some Docker containers show you how to list all the Docker containers on your Docker host. So, let’s get started.
Installing Docker:
I’ve written dedicated articles on installing Docker on Ubuntu/Debian, CentOS and Raspberry Pi. You may check them out if you don’t have Docker installed yet.
- How to Install and Use Docker on Ubuntu 18.04 LTS (https://linuxhint.com/install_docker_ubuntu_1804/)
- Install Docker on Debian 9 (https://linuxhint.com/install_docker_debian_9/)
- Install Docker on CentOS 7 (https://linuxhint.com/install-docker-centos7/)
- Install Docker on Raspberry Pi (https://linuxhint.com/install_docker_raspberry_pi/)
If you still have any problem installing Docker, you may contact me through https://support.linuxhint.com. I will be more than happy to help.
Listing Running Docker Containers:
You can list all the running Docker containers using several Docker commands.
For example, to list all the running Docker containers, you may run one of the following commands:
Or,
Or,
Or,
All the commands above are an alias to one another and they will give you same output. As you can see, all the running containers ID, IMAGE name (the image from which the container is created), startup COMMAND (the command that runs just after the container starts), STATUS, creation time (CREATED), opened PORTS and NAMES (name of the container) are listed.
Listing All Docker Containers:
If you want to list all the containers ever created on your Docker host whether they are running or not, you can run one of the following commands:
Or,
Or,
Or,
As you can see, all the containers whether they are running or not are listed. The same information as before is displayed.
Listing Total File Size Usage of Containers:
If you want to know how much disk space each container is consuming, you can add the -s option with the commands shown above.
For example, to list how much disk space all the running containers are consuming, run the following command:
Again, to list how much disk space all the containers (running or stopped) are consuming, run the following command:
As you can see, the disk space consumption of each container is listed.