Docker is a great tool, and I can't imagine myself managing my servers without it anymore.
But if you are not careful, disk space can be a concern.
docker system df
will show you how much disk space is used and with -v
flag (verbose), you can see the unique image size for each image.
# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 26 24 4.877GB 697.5MB (14%)
Containers 51 51 6.163MB 0B (0%)
Local Volumes 16 16 33B 0B (0%)
Build Cache 0 0 0B 0B
As you can see I have 26 images but only 24 are active, with a total of 697.5Mb
reclaimable.
Run docker image ls
and I can see that it is an older version of my ghost blog, so a docker system prune -a
and problem solved.
One more thing, docker system prune -a
don't remove dangling volumes, for that you need to run docker volume rm $(docker volume ls -q --filter dangling=true)