Question

How to check the disk usage of all running Docker containers?

With the docker system df command you would get a summary of your Docker usage including things like:

  • The total size of all images
  • The total size of all containers
  • The local volumes size
  • And the cache

However, here’s how to check the size of each running container


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 23, 2020
Accepted Answer

By default, if you run docker images you will get the size of each image. However, if you run docker ps you would not get the size of the running containers.

To check the size of each running container what you could do is just use the --size argument of docker ps command.

  1. docker ps --size

You would get the following output:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES               SIZE
d64a8112d00a        nginx               "nginx -g 'daemon of…"   About an hour ago   Up About an hour    0.0.0.0:80->80/tcp   nginx               12MB (virtual 127MB)
ab81be326c31        eboraas/laravel     "/usr/sbin/apache2ct…"   2 hours ago         Up 2 hours          80/tcp, 443/tcp      laravel             92MB (virtual 509MB)

That way you will be able to quickly tell which container exactly is consuming the most disk space.

In case that you need to clear some space, I would recommend checking out this tutorial here on how to remove Docker Images, Containers and Volumes:

https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

Hope that this helps!

Try this: https://github.com/amerkurev/doku/

Doku - Docker disk usage dashboard

The “docker system df” command displays the summary of the amount of disk space used by the docker daemon and “docker system df –v” gives the detailed view.

But we can only get the total file size of each container by using the given command;

       ``` docker ps –s
              Or
          docker ps –-size ``` 

We will be getting the following input:

CONTAINER ID IMAGE COMMAND CREATED STATUS
6c34640e7468 nginx “/docker-entrypoint.…” 12 seconds ago Up 9 seconds
889f6fc3bbd4 httpd:2.4 “httpd-foreground” 2 minutes ago Up 2 minutes
PORTS NAMES SIZE
80/tcp blissful 1.12kB(virtual 133MB)
0.0.0.0:8080 test 2B (virtual 138MB)
  • Size - The amount of data (on disk) that is used by each container (write)
  • Virtual size -The amount of disk space used for the read-only image of each container.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more