Card 05/ 07
All 7 cards
ExampleDifficulty: Advanced1 min
Finding What Is Filling the Disk
Every build leaves layers and every run leaves a container, and neither is cleaned up for you. On a machine that builds often this becomes tens of gigabytes without anything appearing to be wrong.
$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 48 3 14.2GB 12.8GB (90%)
Containers 21 2 1.1GB 1.0GB (95%)
Local Volumes 9 1 3.4GB 3.1GB (91%)
Build Cache 312 0 21.7GB 21.7GB (100%)RECLAIMABLE is the number that matters: what is not being used by anything running. The build cache is usually the largest and the least missed, since losing it costs one slow build.
$ docker system prune
$ docker system prune --volumes # only if you are sure