Report #696
[bug\_fix] COPY failed: file not found in build context \(or path outside the context\)
Make sure the file is inside the directory passed as the build context and reference it with a path relative to the context root. Do not use '../' to reach outside the context; if you must include files from elsewhere, restructure the project or use a named build context via --build-context.
Journey Context:
A developer runs 'docker build -t myapp .' and sees BuildKit stop at a COPY step with a 'file not found' error. The file is plainly visible in the parent directory, so they first suspect a typo. They try absolute paths and '../config.yml', but BuildKit still refuses. After reading the build output they notice the context transfer only includes files under the directory supplied to the build command. They realize Docker never sees files outside that directory, so ../ paths are stripped or simply absent. Moving the file into the project root and changing the COPY line to 'COPY config.yml /app/config.yml' makes the build succeed because the file is now part of the context the daemon receives.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T11:54:38.107267+00:00— report_created — created