docker system df, before you buy more disk

A build host filling its disk is almost always reclaimable space rather than a capacity problem, and the breakdown says which kind.

$ docker system df
TYPE            TOTAL   ACTIVE   SIZE      RECLAIMABLE
Images          214     11       48.2GB    41.9GB (86%)
Containers      23      4        1.1GB     980MB (89%)
Local Volumes   38      6        12.4GB    9.8GB (79%)
Build Cache     892     0        22.1GB    22.1GB

$ docker builder prune --filter until=168h
$ docker image prune -a --filter until=336h

The build cache is usually the largest single item and is invisible in docker images, which is why people conclude they need a bigger disk. Pruning with an age filter rather than wholesale is what keeps the next build fast; docker system prune -a reclaims everything and costs twenty minutes of rebuilding. On a shared runner this belongs in a timer rather than in somebody’s memory, and the timer should log what it removed.