Report #99612
[bug\_fix] COPY fails because the file is excluded by \`.dockerignore\` or a per-Dockerfile ignore file
Inspect \`.dockerignore\` and any \`.dockerignore\` files for patterns that match the file. Remove the pattern, add an exception with \`\!\`, or make the ignore file more specific. Rebuild after the change.
Journey Context:
A developer adds \`.env\*\` to \`.dockerignore\` to avoid leaking secrets. Later they add \`COPY .env.example .\` to the Dockerfile and BuildKit reports the file is not found in the build context. They can see the file with \`ls\`, so they assume Docker is broken and try pruning caches. The real issue is that \`.dockerignore\` removes every \`.env\*\` file before the context is sent to the builder. They change the ignore rule to \`.env\` only and add \`\!.env.example\`, or copy the example file under a different name. The build now sees the file because \`.dockerignore\` matching determines the initial contents of the build context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:45:50.850412+00:00— report_created — created