Docker high disk space usage 💾 📈

andp97

Andrea Pavone

Posted on January 24, 2021

Docker high disk space usage 💾 📈

Did you find an heavy disk space usage on your server and you don't know what is the root cause?

If you do some tests with Docker or you're running some containers on your machine, the cause of this abnormal disk space usage might be just Docker 🐋!

For example on my Raspberry Pi 4 I've seen an heavy space usage on /var/lib/docker/ directory, specially on overlay2:

root@rpi4:/home/user# du -h -d 1 /var/lib/docker/
2,6M    /var/lib/docker/image
15G     /var/lib/docker/overlay2
5,2M    /var/lib/docker/containers
...
17G     /var/lib/docker/
Enter fullscreen mode Exit fullscreen mode

To fix this issue you can employ this command docker system prune see an example:

root@rpi4:/home/user# docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y
Deleted Containers:
64086f34849c92aa2aed8a8757d7c395fbd4a2d77103174bd23a9efc8e0ec333
7be7eda3b32971f39cf08629eaf6d8f42c2677d02f220e0a09a4d955fb0ff5bb
aef03c9d804ae46ed17fa3ecd602a6d335f810a025204f208b3d78186ef26864

Total reclaimed space: 14.04GB
Enter fullscreen mode Exit fullscreen mode

Do you want more information or simply read this article in original language (Italian 🇮🇹)?

💖 💪 🙅 🚩
andp97
Andrea Pavone

Posted on January 24, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related