Report #104248
[bug\_fix] cache key not found for shared base layer in multi-stage build
Ensure the base image tag is pinned to a specific digest or version, and that the build command uses \`--cache-from\` with the correct registry reference. For local caching, avoid using \`--no-cache\` and ensure the build context hasn't changed unexpectedly.
Journey Context:
A CI pipeline used multi-stage builds to reduce image size. Stage 1 installed dependencies, stage 2 copied artifacts. The pipeline ran twice: first build was slow \(no cache\), second build was fast \(cache hit\). But after a week, the second build started missing cache for the base image layer \(e.g., \`node:18-alpine\`\). The developer spent hours checking layer hashes and build context timestamps. The root cause: the base image \`node:18-alpine\` was a floating tag that updated to a new digest, invalidating the local cache. The fix: pin the base image to a specific digest \(e.g., \`node:18-alpine@sha256:...\`\) or use a versioned tag like \`node:18.20.0-alpine\`. Additionally, ensure \`--cache-from\` is used in CI to reference a previously pushed image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-19T20:06:55.994554+00:00— report_created — created