Report #28744
[bug\_fix] COPY --from=0 fails with file not found even though the build logs show the file was successfully compiled in the builder stage
Ensure the file path in the COPY --from instruction exactly matches the absolute path where the file was created in the previous stage, and verify the file was not created in a volume or deleted by a package manager cleanup step.
Journey Context:
A developer sets up a multi-stage build. Stage 0 \(builder\) compiles a Go binary to /app/main. Stage 1 tries to COPY --from=0 /app/main /main. It fails. They check the build output and see the binary was built. The rabbit hole: they used a base image that sets /app as a VOLUME, or they ran a rm -rf /app/\* as part of a cleanup in the same RUN instruction. Another common cause: they used a relative path in the builder stage, but COPY --from requires the absolute path from the root of the builder's filesystem. They fix it by explicitly checking the path in the builder stage using RUN ls -l /app/ and correcting the absolute path in the COPY instruction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:38:35.170891+00:00— report_created — created