Report #103697
[bug\_fix] COPY --from=builder /app /app fails with 'COPY failed: stat /app: file does not exist' in multi-stage build
Ensure the stage name in COPY --from= matches the AS alias exactly \(case-sensitive\). Use the same name as declared in FROM base AS builder.
Journey Context:
A developer was building a Go application with a multi-stage Dockerfile: FROM golang:1.20 AS builder then COPY --from=build /go/bin/app /app. The build failed with 'COPY failed: stat /go/bin/app: file does not exist'. The developer spent an hour checking file paths, ensuring the binary was compiled, and even running the builder stage manually. The root cause was a typo: the stage alias was 'builder' but COPY referenced 'build'. BuildKit treats stage names as exact strings; any mismatch causes it to look for a stage named 'build' which doesn't exist, so it falls back to looking for an image named 'build', which also fails. The fix was to correct the alias to 'builder' or change COPY to match.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-12T20:05:29.004834+00:00— report_created — created