Docker Tip #44: Show Total Disk Space Used by Docker
Here's a simple command to show you much disk space is being taken up by Docker images, containers, volumes and build cache.
Docker has a system
sub-command that has a few useful commands. One of them is
docker system df
which reports back disk space usage stats of your
Docker installation.
Here’s what the output of docker system df
looks like on my machine:
TYPE | TOTAL | ACTIVE | SIZE | RECLAIMABLE |
Images | 212 | 0 | 63.72GB | 63.72GB (100%) |
Containers | 0 | 0 | 0B | 0B |
Local Volumes | 77 | 0 | 1.01GB | 1.01GB (100%) |
Build Cache | 0 | 0 | 0B | 0B |
This is on a machine with dozens of real world Dockerized projects that are mostly Flask, Rails, Phoenix and NodeJS apps spanning across multiple versions.
My build cache is empty because I run docker system prune
as a daily scheduled
task. If you want to see how to set that up on any OS, check out
Docker Tip #32.
You can pry even deeper by using the -v
flag (verbose). It will show you the
unique image size for each image. You’d be surprised at how small some of them
are!
What does your df output look like? Let me know in the comments below.