brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: run docker system df before you prune anything

Docker
~/tips/docker-system-df

docker system df

Shows how much disk space Docker uses before you delete anything with prune.

When a server says the disk is full, my reflex would be to run a prune. My advice is to look first.

docker system df shows how much disk space the Docker daemon uses, split into images, containers and local volumes, with a RECLAIMABLE column that tells you how much could be freed.

docker system df
docker system df -v

The -v flag lists every image, container and volume with its size, so you can see which one is the heavy one. The first command is enough to learn whether Docker is even the problem. Often it is not, and then a prune only deletes things for nothing.

One caveat: a volume that no container uses right now is not necessarily garbage. It can hold the data of an app that is stopped for the moment. Read the list before you remove anything, and do not run a prune with the volumes option until you have.

Animation: typing docker system df and docker system df -v in a terminal
The two commands from this tip

Further reading: Docker docs: docker system df, On this site: docker image prune -a –filter until= only removes old images, On this site: back up a Docker volume with a throwaway tar container

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link