Report #93492
[bug\_fix] COPY failed: file not found in build context \(when using COPY --from=builder\)
Ensure the path specified in \`COPY --from= \` refers to the absolute path inside the previous build stage, not the host machine or the current working directory of the subsequent stage.
Journey Context:
A developer creates a multi-stage build. Stage 1 \(builder\) compiles a binary to \`/app/build/myapp\`. Stage 2 uses \`COPY --from=builder myapp /usr/local/bin/\`. It fails with 'not found'. The developer assumes the path is relative to the \`WORKDIR\` set in stage 1, or tries to use a host path. They debug by adding an \`ls\` command in stage 1 to verify the file exists. They realize \`COPY --from\` requires the source path to be the absolute path within the filesystem of the named stage, starting from root. Correcting the source path to the absolute path inside the builder stage \(\`COPY --from=builder /app/build/myapp /usr/local/bin/\`\) resolves the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:30:43.188046+00:00— report_created — created