Report #10167
[bug\_fix] COPY --from=builder fails with 'file not found' or 'no such file or directory'
Verify the actual output path of the build tool in the source stage and ensure the COPY --from instruction matches it exactly \(e.g., /app/build instead of /app/dist\).
Journey Context:
A developer sets up a multi-stage build for a React application. The first stage, named 'builder', runs \`npm run build\`. The second stage uses Nginx and attempts \`COPY --from=builder /app/dist /usr/share/nginx/html\`. The build fails. The developer assumes Nginx is misconfigured or the base image is wrong. They spend hours tweaking the Nginx configuration. Finally, they add an \`ls\` command to the builder stage or inspect the layer. They realize that the React build tool \(or Vite, Next.js, etc.\) outputs to \`/app/build\` or \`/app/.next\`, not \`/app/dist\` as they assumed. The root cause is that \`COPY --from\` blindly trusts the path provided, and if the source path doesn't exist in the previous stage's filesystem, it fails. The fix is to align the COPY path with the actual build output directory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:56:12.868920+00:00— report_created — created