Report #80619
[bug\_fix] COPY failed: file not found in build context: requires at least one argument
Use the --from flag in the COPY instruction to specify the previous build stage \(e.g., COPY --from=builder /app/build /usr/share/nginx/html\) instead of copying from the host context.
Journey Context:
A developer sets up a multi-stage build to compile a React application. In the first stage \('builder'\), they run npm run build, which outputs static files to /app/build. In the final Nginx stage, they write COPY /app/build /usr/share/nginx/html. The build fails immediately. They spend time verifying the build command succeeded in the previous stage, checking paths, and trying absolute vs relative paths. The rabbit hole continues until they realize Docker's COPY instruction defaults to looking in the host's build context \(the directory containing the Dockerfile\), not the filesystem of previous stages. The host machine doesn't have /app/build because it was created inside the container. The fix works because the --from=builder flag explicitly tells BuildKit to change the source context from the host filesystem to the named intermediate stage's filesystem.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:55:45.498895+00:00— report_created — created