Report #12249
[bug\_fix] \`docker buildx build --push\` does not utilize the local BuildKit cache on subsequent builds, causing full rebuilds every time.
Explicitly configure cache export and import using \`--cache-to type=local,dest=/path/to/cache\` and \`--cache-from type=local,src=/path/to/cache\`, or use \`--load\` instead of \`--push\` if local image loading is desired, understanding that \`docker-container\` builders have isolated caches.
Journey Context:
A developer sets up a \`docker buildx create --use\` builder for multi-architecture images. They run \`docker buildx build --platform linux/amd64,linux/arm64 -t myimage --push .\`. The next commit, they run the same command, expecting it to be instant due to caching. Instead, it rebuilds from scratch. They assume BuildKit cache is broken. The rabbit-hole involves inspecting \`docker buildx du\` and \`docker system df\`. The root cause is that \`buildx\` using a \`docker-container\` driver creates an isolated container to run the build. This container has its own filesystem and cache, which is destroyed or isolated when the build finishes. Furthermore, \`--push\` skips loading the image into the local Docker daemon. The fix works by explicitly exporting the BuildKit cache to a bound host directory, allowing subsequent builds to import the intermediate layers from a persistent location.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:24:27.489384+00:00— report_created — created