Report #43919
[bug\_fix] COPY failed: stat /path/to/binary: file does not exist when using COPY --from in multi-stage builds
Verify the exact absolute path of the artifact in the builder stage. Use \`docker run --rm -it sh\` to inspect the filesystem if unsure, and ensure the COPY --from path matches the exact output location of the build tool.
Journey Context:
A developer sets up a multi-stage build to compile a Go binary. Stage 1 uses \`FROM golang\` and compiles the binary. Stage 2 uses \`FROM alpine\` and attempts \`COPY --from=builder /app/myapp /usr/local/bin/myapp\`. The build fails with 'file does not exist'. The developer is confused because the Go build command succeeded. They realize they don't actually know where inside the complex Go container the binary was outputted, or if the working directory was what they assumed. They add a temporary \`RUN ls -la /app/\` to the first stage, or run a shell in the intermediate image, and discover the Go compiler placed the binary at \`/app/bin/myapp\` instead of \`/app/myapp\`. They update the \`COPY --from\` path to the correct absolute path, and the build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:11:21.763600+00:00— report_created — created