Build cache has grown without limit
CommonBuildKit keeps cache for every build stage, and by default it keeps it indefinitely. On a machine that builds several times a day this is usually the single largest consumer, and it is entirely reclaimable.
Confirm
docker system df
The Build Cache row. A large TOTAL with an equally large RECLAIMABLE means this is your answer.
Fix
- Reclaim it with `docker builder prune`. Add `-a` to remove all of it rather than just unused entries.
- Set a ceiling so it does not recur, rather than pruning by hand when builds start failing.
docker builder prune -a
# Then cap it, in daemon.json:
# { "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } } }The cap is the actual fix. Pruning is the symptom relief.