Clean up Docker disk space

Docker quietly ate 40 GB of my disk. Here is how to get it back.

SNP 025 #A42 Filed docker cmd

See what is taking the space:

shell
docker system df

Remove stopped containers, unused networks, dangling images and the build cache:

shell
docker system prune

Add -a to also drop every image that no running container uses, and --volumes if you want unused volumes gone too. Be careful with that last one, volumes are where databases keep their data.

shell
docker system prune -a --volumes