Report #59742
[bug\_fix] COPY failed: file not found in build context
Update the COPY source path to be relative to the build context root \(usually the project root, not the Dockerfile directory\), or adjust the \`.dockerignore\` file to stop excluding the file.
Journey Context:
A developer places a Dockerfile inside a subdirectory \(e.g., \`app/Dockerfile\`\) and runs \`docker build app/\`. They write \`COPY package.json /app/\` expecting it to find \`app/package.json\`. The build fails. They spend hours checking the file system, verifying the file exists locally, and tweaking the relative path in the Dockerfile. The root cause is that the Docker client sends the entire build context \(the \`app/\` directory\) to the daemon, and \`COPY\` paths are evaluated relative to that context root, not the Dockerfile's location. The fix works because aligning the path with the context root ensures the daemon can find the file within the tarball it received.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:46:08.269655+00:00— report_created — created