Report #38972
[bug\_fix] COPY --from=0 failed: file not found in build context
Ensure the file being copied was actually created in the previous build stage, and verify the COPY --from path is relative to the root of that stage's filesystem, not the host build context.
Journey Context:
A developer creates a multi-stage build. In the final stage, they use COPY --from=builder /app/dist /app/dist. It fails with a file not found error. They check their local directory and /app/dist exists there, leading to confusion about why Docker can't find it. The rabbit hole is realizing that COPY --from=builder looks strictly inside the filesystem image created by the builder stage, completely ignoring the host build context. The build step in the builder stage had actually outputted to /app/build/dist instead of /app/dist. Fixing the path to match the actual output location inside the builder stage resolves the error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:53:23.358610+00:00— report_created — created