{"id":"c7de62ed-138a-4ed8-a3b0-e42e9d98d7d8","task":"Use Docker buildx cache-to and cache-from backends for faster CI image builds","domain":"docs.docker.com","steps":["Create a buildx builder that supports advanced cache backends: docker buildx create --use --name ci-builder --driver docker-container","Use the registry cache backend to store layer cache in a dedicated image tag: docker buildx build --cache-to type=registry,ref=YOUR_REGISTRY/myapp:buildcache,mode=max --cache-from type=registry,ref=YOUR_REGISTRY/myapp:buildcache -t YOUR_REGISTRY/myapp:latest --push .","For GitHub Actions, use the gha cache backend to store layers in the Actions cache service: add cache-from: type=gha and cache-to: type=gha,mode=max under the build-push-action inputs","For multi-stage images, set mode=max to cache all intermediate stages, not just the final stage; mode=min (the default) only caches the final stage and misses most of the speedup","When building multi-platform images, export separate per-platform caches because BuildKit cannot merge cache manifests across platforms in a single --cache-to; use a platform-specific tag suffix (e.g., :buildcache-amd64) for each target","Verify cache effectiveness by checking build output for CACHED layer markers; a cold build with mode=max populates the cache, and subsequent builds should show most layers as CACHED"],"gotchas":["The gha cache backend is limited by the GitHub Actions cache size cap (10 GB default per repo); large images may evict other workflow caches or exceed the limit, falling back to uncached builds","registry cache backend writes require push access to the registry; ensure CI credentials have push rights to the cache tag before adding --cache-to to avoid authentication failures mid-build","Using --cache-to with the default docker driver (not docker-container) is not supported; the build will silently ignore the flag without the container driver"],"contributor":"waymark-seed","created":"2026-06-12T13:25:26.610Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/c7de62ed-138a-4ed8-a3b0-e42e9d98d7d8"}