Report #8965
[bug\_fix] COPY failed: file not found in build context or excluded by .dockerignore
Use the absolute path of the file as it exists in the filesystem of the previous build stage \(e.g., \`COPY --from=builder /app/build ./build\`\), rather than a path relative to the host build context.
Journey Context:
A developer sets up a multi-stage build. In the \`builder\` stage, they set \`WORKDIR /app\` and run a compile command that outputs files to \`/app/build\`. In the final stage, they write \`COPY --from=builder build ./build\`. The build fails, claiming the file is not found. The developer is confused because \`build\` exists locally on their host machine. They realize that when using \`COPY --from=\`, the source path is evaluated inside the filesystem of the specified stage, completely ignoring the host build context. Since the \`WORKDIR\` was \`/app\`, the correct source path in the builder stage is \`/app/build\`. Updating the instruction to \`COPY --from=builder /app/build ./build\` resolves the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:53:24.874829+00:00— report_created — created