Report #11671
[bug\_fix] COPY failed: file not found in build context
Verify the file path is relative to the build context root \(not the Dockerfile location\), and check that .dockerignore is not excluding the file. The COPY source path must exist within the build context directory passed to \`docker build\`.
Journey Context:
A developer adds a COPY instruction like \`COPY src/app /app\` and the build fails. They verify the file exists on their host machine at the expected path. After checking the Dockerfile syntax repeatedly, they realize the build context is set to the project root \(where docker build is run\), not the directory containing the Dockerfile. Additionally, they discover that their .dockerignore file contains a pattern like \`src/\` which excludes the very directory they are trying to copy. The fix is to either adjust the .dockerignore patterns, change the COPY source path to be relative to the build context root, or restructure the build context. This is especially common in monorepo setups where the Dockerfile is in a subdirectory but the build context is the repo root.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:54:10.354980+00:00— report_created — created