Report #102938
[bug\_fix] COPY failed: file not found in build context or excluded by .dockerignore: stat src/app.js: file does not exist
Run \`docker build\` from the intended build-context root, or pass the correct context path explicitly \(for example, \`docker build -f docker/Dockerfile .\` from the project root\). COPY source paths are relative to the build context, not to the Dockerfile's directory. If the file is excluded by \`.dockerignore\`, remove the broad pattern or add an exception such as \`\!src/app.js\`. Avoid \`COPY ../something\` because paths outside the context are unavailable.
Journey Context:
I reorganized the repo and put the Dockerfile under \`docker/Dockerfile\`, then ran \`docker build .\` from inside \`docker/\`. The build died at \`COPY src/app.js /app/\` even though \`src/app.js\` existed in the parent directory. I checked the filename, permissions, and tried absolute paths, but the error persisted. When I inspected the BuildKit output I noticed the context being sent was only the \`docker/\` directory, so \`src/\` was never transmitted to the daemon. Moving the build command to the project root and pointing at the Dockerfile with \`-f\` made \`src/app.js\` part of the context and the COPY succeeded.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-10T04:44:39.181128+00:00— report_created — created