List of Docker containers

The continuation of a series of articles about Docker. Last we discussed how to create a container based on the image. Today I want to tell you more how to see the list of containers to know which ones running, what fell, and what all would have to remove so that they do not occupy disk space.

To view the list of containers, use the command docker ps. It allows you to see how running Docker containers, and all containers in the system.

  • The syntax of the command docker ps
  • Running Docker containers
  • Insights

The syntax of the command docker ps

In the command syntax, there is nothing complicated:

$ docker ps options

Here are the main options:

  • –all , -a – display all the containers and started or not;
  • –filter , -f, – filter the container when it is output;
  • –format – a more beautiful list of containers;
  • –last , -n show only N latest created containers;
  • –latest , -l – show only the last container;
  • –no-trunc – don’t trim the output;
  • –quiet , -q show only numeric identifiers of the containers;
  • –size , -s shows the size of the container.

Now let’s understand in more detail how to see the Docker containers.

Running Docker containers

By default the docker ps lists only running containers and truncates fields that are too long:

docker ps

To display the containers without clipping information, use the parameter –no-trunc:

docker ps --no-trunc

To look at not only the running containers, and all, use the option -a:

docker ps-a

You can filter containers by name, for example, to display only those names containing the Ubuntu1804:

docker ps --filter name=Ubuntu1804

There are other filters, but I am not going to describe them if you need them, view the official documentation. In order to bring in the list of Docker containers additionally the size of the container, use the option -s:

docker ps-a-s

The team shows two sizes. The first of these is the volume occupied by the recorded portion of the container. Second dimension -the virtual, is the total space occupied and captured part of the container, and read-only data of the image.

Option -l can be used to view only the last created image. This can be useful, for example, to get its ID:

docker ps-l

If you are wondering where are stored the docker containers , then you use the command docker inspect. It allows you to view detailed information about the container. The container has multiple folders for different purposes, let’s look MergedDir:

docker inspect --format='{{json .GraphDriver.Data.MergedDir}}' PhpMyAdmin

With the same success you can look LogPath or other directories of cantarea.


In this article, you learned how to perform a review of Docker containers. This is relatively simple compared to the creation of container, but also not less important.


(Visited 4 times, 1 visits today)