Report #84771
[bug\_fix] COPY failed: forbidden path outside the build context
Move the file into the build context directory, or adjust the docker build context path. For example, instead of running docker build from a subdirectory, run it from the project root using docker build -f deploy/Dockerfile . so the parent directory files are included in the context.
Journey Context:
A developer tries to organize their project by placing the Dockerfile in a subdirectory \(e.g., deploy/Dockerfile\). They run docker build -t myapp deploy/. The Dockerfile contains COPY ../src /app/src. The build fails with a forbidden path error. They try changing relative paths, using absolute paths, or symlinks, but it keeps failing. They eventually realize that the Docker CLI sends the deploy/ directory as the build context to the daemon. The daemon cannot access anything outside this context for security and portability reasons. The fix is to move the Dockerfile to the root or point the context to the root using docker build -f deploy/Dockerfile ., which makes the project root the context, allowing COPY src /app/src to succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:52:45.853267+00:00— report_created — created