Report #11675
[bug\_fix] COPY --from= failed: no such stage:
Ensure the stage name in the COPY --from directive exactly matches the AS alias in the FROM instruction of the target stage. Stage names are case-sensitive and must not contain spaces. Also verify the stage appears before the COPY instruction in the Dockerfile.
Journey Context:
A developer creates a multi-stage Dockerfile with \`FROM golang:1.21 AS builder\` and later \`FROM alpine:3.18\`. They add \`COPY --from=build /app/binary /app/binary\` but get 'no such stage: build'. They stare at the Dockerfile and do not see the issue — the stage is clearly defined. The problem is a simple typo: the stage is aliased as \`builder\` but referenced as \`build\`. After correcting to \`COPY --from=builder\`, the build succeeds. This error also occurs when developers accidentally delete or rename a stage alias without updating all references, or when they reference an external image that does not exist \(COPY --from can also reference external images like \`COPY --from=nginx:latest /etc/nginx /etc/nginx\`\). In the external image case, the error message is the same but the root cause is a missing or misspelled image tag.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:55:10.250740+00:00— report_created — created