Report #11880
[bug\_fix] COPY --from=builder: file not found \(or: COPY --from=0: not found, or: no such stage: builder\)
Verify that the source path in the COPY --from instruction exists in the specified build stage. The path is relative to that stage's WORKDIR, not the build context. Also ensure the stage name in --from= exactly matches the AS alias in the FROM instruction \(case-sensitive\). If copying from an external image, ensure the image and path exist. Use docker run --rm on the intermediate stage image to inspect actual file locations.
Journey Context:
A developer creates a multi-stage Dockerfile with FROM node:18 AS builder, builds the app, then in a later stage writes COPY --from=builder /app/dist /app/dist. The build fails with 'COPY --from=builder: file not found'. They check that the builder stage completes successfully and assume /app/dist exists. The issue turns out to be that the build output is at /app/build/dist, not /app/dist — the developer assumed the wrong output path based on the framework's defaults. In another common variant, the developer writes COPY --from=builder dist /app/dist without the leading slash, and the path resolves relative to the WORKDIR of the builder stage, which might not be what they expect. The fix is to inspect the intermediate stage by adding a temporary RUN ls -la /app/ in the builder stage, or by running docker run --rm on the intermediate image to verify actual file locations, then use the correct absolute paths in COPY --from. Another common variant: the stage alias has a typo \(FROM node:18 AS build vs COPY --from=builder\), which causes 'no such stage: builder'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:27:23.847229+00:00— report_created — created