Report #2611
[bug\_fix] BuildKit remote cache lookup fails with \`ERROR: failed to solve: cache key not found\` when using \`--cache-from type=registry,ref=...\`
Export cache metadata when you push, then import it on later builds. For the inline backend, build and push with \`docker buildx build --push --build-arg BUILDKIT\_INLINE\_CACHE=1 -t .\` and later use \`--cache-from type=registry,ref=\`. For the registry backend, export explicitly with \`--cache-to type=registry,ref=,mode=max --push\` and import with \`--cache-from type=registry,ref=\`. The root cause is that \`--cache-from\` only tells BuildKit where to look; if the manifest at that reference contains no cache metadata \(because it was never exported or the registry stripped it\), BuildKit cannot resolve a cache key.
Journey Context:
You add \`--cache-from type=registry,ref=myapp:latest\` to a CI job expecting layers to be reused, but the job logs \`cache key not found\` and rebuilds everything from scratch. The image \`myapp:latest\` is present in the registry, so you assume the cache is corrupt and try a fresh push. The next pull still fails. After reading the BuildKit cache docs you realize that a normal \`docker push\` does not attach cache metadata unless \`BUILDKIT\_INLINE\_CACHE=1\` was set during build, or unless you used a separate \`--cache-to\` export. You rebuild once with \`--cache-to type=registry,ref=myapp:cache,mode=max --push\` and the following \`--cache-from type=registry,ref=myapp:cache\` run restores layers instantly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T13:27:48.967652+00:00— report_created — created