Report #4398
[bug\_fix] \`COPY failed: file not found in build context: stat : file does not occur\`
Check the \`.dockerignore\` file for broad glob patterns that are unintentionally excluding required files from the build context.
Journey Context:
A developer adds a new configuration file \`app.json\` to their project and updates the Dockerfile with \`COPY app.json /app/\`. The build fails with 'file not found in build context'. They verify the file exists locally, check for typos, and restart Docker Desktop. The error persists. They dive into BuildKit issues, thinking the context isn't being sent. Finally, they inspect \`.dockerignore\` and find a rule \`\*.json\` that was added to keep \`package-lock.json\` out of the image. This rule is excluding \`app.json\` from the context sent to the daemon. Adding an exception \`\!app.json\` or narrowing the rule fixes it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:21:09.406810+00:00— report_created — created