Report #923
[bug\_fix] Multi-stage build fails at \`COPY --from=builder ...\` with \`failed to compute cache key: ... not found\` or \`COPY failed: stat ... file does not exist\` because the source path or stage name is wrong.
Make sure the \`COPY --from=\` source path matches the exact absolute path inside the named stage, that the stage actually produced the artifact, and that the stage alias matches \`FROM ... AS \`. Verify by building with \`--target builder\` to inspect the stage.
Journey Context:
You dockerize a Go service. Stage one uses \`FROM golang:1.22 AS builder\`, sets \`WORKDIR /app\`, and runs \`go build -o server\`. Stage two uses \`FROM alpine\` and \`COPY --from=builder /server /usr/local/bin/server\`. The build fails saying \`/server\` is not found. You inspect stage one with \`docker build --target builder -t debug .\` and run it; the binary is at \`/app/server\`, not \`/server\`, because \`WORKDIR /app\` changed the working directory. Changing the COPY to \`COPY --from=builder /app/server /usr/local/bin/server\` fixes it. Another common variant is a typo in the stage alias or copying before the artifact is generated. Each stage filesystem is isolated; only absolute paths from that stage's final layer are available.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T14:58:30.448396+00:00— report_created — created