Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #44: Show Total Disk Space Used by Docker

docker-tips-and-tricks.jpg

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:

TYPETOTALACTIVESIZERECLAIMABLE
Images212063.72GB63.72GB (100%)
Containers000B0B
Local Volumes7701.01GB1.01GB (100%)
Build Cache000B0B

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.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.



Comments