Report #104563
[bug\_fix] COPY --from=builder fails: stage not found or invalid reference
Verify the stage name or index used in \`COPY --from=\` matches exactly the \`FROM ... AS \` in the Dockerfile. Use numeric index only if stages are unnamed \(e.g., \`--from=0\`\). Ensure the stage is defined before the COPY instruction.
Journey Context:
A multi-stage Dockerfile had \`FROM node:16 AS build\` and later \`COPY --from=builder /app/dist /usr/share/nginx/html\`. The build failed with 'invalid COPY --from: stage builder not found'. The developer spent hours checking spelling and case. The actual mistake: the stage was named 'build' but the COPY referenced 'builder'. A simple typo. After correcting to \`COPY --from=build\`, it worked. Another case: using \`--from=1\` when stages are reordered. The fix is to always use descriptive stage names and double-check them. This error is extremely common in CI/CD pipelines where Dockerfiles evolve.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-06T20:06:08.903670+00:00— report_created — created