How to List Docker Containers

29/12/2020
Docker as you all know is a great containerization software. With Docker, you can create lightweight containers and run the apps and services you want in an isolated virtual environment.

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.

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:

$ docker container ls

Or,

$ docker container list

Or,

$ docker container ps

Or,

$ docker ps

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:

$ docker container ls -a

Or,

$ docker container list -a

Or,

$ docker container ps -a

Or,

$ docker ps -a

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:

$ docker container list -s

Again, to list how much disk space all the containers (running or stopped) are consuming, run the following command:

$ docker container ls -as

As you can see, the disk space consumption of each container is listed.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to Use Docker on Arch Linux

Today, let’s check out the usage of Docker on Arch Linux – an elite Linux distro, for the elites! Docker features The...
29/12/2020

Docker-Compose MongoDB

Maintaining the state of your Mongo container across updates. TL;DR For those who are familiar with the workings of MongoDB...
29/12/2020

Storing and Sharing with Docker Volumes

In Docker, you can write data on the writable layer. But the data doesn’t persist after a container shuts down. Also,...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024