Report #44849
[bug\_fix] COPY --from=0 \(or builder stage\) fails with 'file not found' despite build logs showing the artifact was created
Use the absolute path of the artifact in the COPY --from instruction, accounting for the WORKDIR set in the previous stage. If WORKDIR was set to /app and the build output is locally \`dist/\`, the absolute path for COPY --from will be \`/app/dist/\`.
Journey Context:
In a multi-stage build, a developer sets \`WORKDIR /app\` in the builder stage and runs \`npm run build\`, which outputs files to a local \`dist/\` directory. In the final stage, they attempt \`COPY --from=builder /dist /usr/share/nginx/html\`. The build fails with 'file not found'. The developer is baffled because the build logs clearly show the files being generated. They spin up a temporary container from the builder stage using \`docker run --rm -it sh\` and run \`ls /\`. They discover that because \`WORKDIR /app\` was set, the \`dist\` folder was created at \`/app/dist\`, not \`/dist\`. They update the COPY instruction to \`COPY --from=builder /app/dist /usr/share/nginx/html\`, and the build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:44:42.173323+00:00— report_created — created