Report #44294
[bug\_fix] COPY failed: forbidden path outside the build context
Move the required file into the build context directory \(usually the directory containing the Dockerfile\) and update the COPY path, or change the build context path in the docker build command. Docker strictly prohibits copying files from outside the defined build context for security and build reproducibility.
Journey Context:
A developer attempts to share a local configuration file located in a parent directory using \`COPY ../config.yaml /app/\` in their Dockerfile. The build immediately fails with a 'forbidden path' error. They try using symlinks pointing outside the context, which also fails. They spend time investigating Docker daemon permissions and BuildKit security policies before realizing that the Docker client only sends the specified build context \(the \`.\` at the end of \`docker build .\`\) to the daemon. The daemon has no access to the host filesystem outside this context. The fix is to either move the file into the context directory or 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-19T04:49:05.359028+00:00— report_created — created