KamoCRM

Cap BuildKit history and tame builder GC in dockerd config

FixKlusterServices
Shipped
November 14, 2026 at 9:43 PM UTC
Author
Kamo
Commit
18b221a

With no prune running, `docker rm` of a finished CI job container still took 15-100 s: it waits for a containerd GC pass (leases.Delete -> gcScheduler.ScheduleAndWait), and each pass spent that time in the mark phase (getMarked/scanRoots) walking a metadata DB bloated by BuildKit build history that was never trimmed: moby_history held 2,694 leases and 18,701 blobs back to the last dockerd start (2026-09-28), ~8x everything else. - builder.history: maxAge 48h, maxEntries 100. - builder.gc: replace the default 4-rule policy (rule #0 capped local contexts/cache mounts at 2.57 GiB, deleting cache after builds) with one hard backstop: max 80 GB cache, prune when < 40 GB free. Routine cleanup is the idle-window k1m1-docker-prune.sh. Apply only in a quiet CI window: restarting docker also stops forgejo-runner.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing