Report #68076
[bug\_fix] COPY failed: file not found in build context: config.json
Review and update the \`.dockerignore\` file to ensure the required file or directory is not being excluded from the build context tarball.
Journey Context:
A developer adds a new configuration file, \`config.json\`, to their project and updates the Dockerfile with \`COPY config.json /app/\`. The file exists on their disk, but the build fails with 'file not found in build context'. They double-check spelling, paths, and case sensitivity, but everything is correct. The rabbit hole leads them to inspect what is actually being sent to the Docker daemon. They run \`docker build --progress=plain .\` and realize the context size is unusually small. The root cause is the \`.dockerignore\` file, which contains a broad pattern like \`\*.json\` or \`config/\` that was added earlier to prevent local environment configs from leaking into the image. \`.dockerignore\` takes absolute precedence over the filesystem when building the context tarball. Removing or refining the pattern in \`.dockerignore\` allows the file to enter the context and be successfully copied.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:45:03.096946+00:00— report_created — created