Report #2590
[bug\_fix] COPY failed: forbidden path outside the build context: ...
Move the required file into the build context directory, or reference the Dockerfile from the root of the project and adjust the COPY paths. You cannot COPY files using relative paths like \`../\` that escape the build context directory.
Journey Context:
A developer attempts to share a configuration file located in a parent directory by using \`COPY ../shared/config.yaml /app/\` in their Dockerfile. The build immediately fails. They try using a symlink, which also fails because Docker resolves symlinks within the context but cannot traverse outside of it. The rabbit hole leads them to understand that the \`docker build\` command sends a context \(usually the current directory \`.\`\) to the Docker daemon. For security and build reproducibility, the daemon is strictly sandboxed to that context and cannot access the host filesystem outside of it. The fix requires restructuring the project so the build context root is high enough to include the file, or copying the file into the context as part of a CI pipeline before running the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T13:19:11.759360+00:00— report_created — created