Report #49789
[bug\_fix] COPY failed: file not found in build context
Remove the file or directory pattern from the .dockerignore file, or adjust the COPY source path to match a file actually included in the build context.
Journey Context:
A developer adds a new configuration file or dependency directory to their project and updates the Dockerfile with a COPY instruction. The build fails, claiming the file doesn't exist. They check their local directory a dozen times—the file is definitely there. They try absolute paths, relative paths, and changing permissions, but nothing works. The debugging rabbit hole deepens until they realize Docker resolves the build context before executing the Dockerfile. They open the .dockerignore file and discover a broad exclusion pattern \(like ignoring all .json files, or a wildcard that matches the target directory\) is silently stripping the file out of the context tarball sent to the daemon. The fix works because removing the pattern from .dockerignore allows the file to actually enter the isolated build context where the COPY instruction operates.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:03:20.555128+00:00— report_created — created