Report #104655
[bug\_fix] cache key not found: sha256:...
Use \`--cache-from\` with the same image tag or digest that was previously built and pushed, and ensure the cache source image is pulled locally. For multi-stage builds, cache each stage separately using \`--cache-from\` multiple times. Alternatively, use \`--cache-to\` with \`mode=max\` to export all layers.
Journey Context:
I was trying to speed up CI by using BuildKit's cache from a registry. I set \`--cache-from=myregistry/myimage:cache\` but got 'cache key not found'. I assumed the cache image existed but it was built with different build args or Dockerfile version. The rabbit-hole involved checking the registry, pulling the image manually, and comparing layer digests. The root cause was that BuildKit's cache lookup requires exact layer matches; even a different \`FROM\` image base would invalidate. The fix was to ensure the cache image was built with identical build context and args, and to use \`--cache-to\` with \`mode=max\` to export all layers. Also, I had to explicitly pull the cache image before the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:05:07.514427+00:00— report_created — created