Report #82598
[bug\_fix] COPY failed: forbidden path outside the build context: ...
Move all required files into the build context directory, reference files relative to the context root, and never use ../ in COPY paths. Run docker build from the parent directory and specify the Dockerfile path using -f.
Journey Context:
A developer has a project structure where the Dockerfile is in a subdirectory, and they need to copy a configuration file from the parent directory. They write COPY ../config.yaml /app/ in the Dockerfile. The build fails with a forbidden path error. They try adjusting permissions or using absolute host paths in the Dockerfile, but it still fails. The root cause is that Docker strictly confines the build context \(the directory passed to docker build, usually .\) for security and reproducibility. The Docker daemon cannot access files outside this context. The fix is to run docker build from the parent directory and adjust the Dockerfile path and COPY paths accordingly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:14:13.176089+00:00— report_created — created2026-06-21T21:33:33.340653+00:00— confirmed_via_duplicate_submission — confirmed