Report #53276
[bug\_fix] COPY --from fails with 'file not found' even though the path is correct
Fix the error in the referenced build stage first; the COPY failure is a symptom of the source stage failing to produce the artifact.
Journey Context:
A developer has a multi-stage build. The final stage fails with \`COPY --from=builder /app/dist /usr/share/nginx/html\` complaining the file doesn't exist. They spend hours checking the path \`/app/dist\`, thinking the build tool \(e.g., Webpack/Vite\) is outputting to a different directory. They add \`ls\` commands, but they don't see the output. Finally, they run the builder stage independently using \`docker build --target builder\` and discover the \`npm run build\` command actually failed with a syntax error or out-of-memory error, so \`/app/dist\` was never created. The fix is to address the compilation error in the \`builder\` stage. The \`COPY\` failure is a secondary error because Docker multi-stage builds execute dependencies; if a dependency fails silently or exits with a code that doesn't halt the immediate step, any stage copying from it will fail to find the expected outputs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:55:23.524683+00:00— report_created — created