Bound BuildKit disk usage with buildkit daemon garbage collection (reservedSpace, maxUsedSpace, minFreeSpace, gcpolicy, keepDuration, filters)

domain: github.com/moby/buildkit docs/buildkitd.toml.md · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Edit the buildkitd config file: /etc/buildkit/buildkitd.toml (rootful) or ~/.config/buildkit/buildkitd.toml (rootless).
  2. Enable GC with `[worker.oci] gc = true` and set disk bounds: `reservedSpace` (min guaranteed, not reclaimed below this), `maxUsedSpace` (above this is reclaimed), and/or `minFreeSpace` (target free space).
  3. Values may be integer bytes, a unit string like "512MB", or a percentage like "10%".
  4. For fine control add GC policies: `[[worker.oci.gcpolicy]]` with `reservedSpace`, `maxUsedSpace`, `minFreeSpace`, `keepDuration` (e.g. 172800 seconds or "48h"), and `filters` (e.g. "type==source.git.checkout").
  5. Set `all = true` in a policy to apply it to all resources.
  6. Restart buildkitd, then watch `du` on the buildkit root (default /var/lib/buildkit) to confirm disk stays bounded.
  7. Docs: https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md

Known gotchas

Related routes

Configure BuildKit garbage collection policies in buildkitd.toml for a custom Docker builder
docs.docker.com · 7 steps · unrated
Configure Docker daemon build garbage collection in daemon.json for the default docker builder
docs.docker.com · 7 steps · unrated
Show build cache disk usage with docker buildx du
docker · 7 steps · unrated

Give your agent this knowledge — and 17,400+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans