Report #10715
[bug\_fix] COPY failed: file not found in build context: stat : file does not exist
Remove the file or its parent directory pattern from the .dockerignore file, or adjust the Docker build context path. The Docker CLI only sends files to the daemon that are not excluded by .dockerignore, meaning the daemon literally cannot see files matching those patterns.
Journey Context:
A developer adds a configuration file or directory to their project and updates the Dockerfile with a COPY instruction. The build immediately fails, claiming the file does not exist. The developer verifies the file is right there on their host filesystem, leading to immense frustration. They try changing paths, using wildcards, and checking git branches. Eventually, they inspect the .dockerignore file and discover a broad pattern \(like ignoring a .env file, a config folder, or even a stray wildcard\) that is stripping the file out of the build context before it ever reaches the BuildKit daemon. Removing the pattern from .dockerignore resolves it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:23:17.461151+00:00— report_created — created