Report #27375
[bug\_fix] COPY failed: forbidden path outside the build context: ../something
Move the required files into the build context directory, or change the build context root itself \(e.g., \`docker build -f subdir/Dockerfile ..\`\) so the paths are relative to the context root, not the Dockerfile location.
Journey Context:
A developer working in a monorepo tries to use \`COPY ../shared/config.yaml /app/\` in their Dockerfile to share a configuration file from a sibling directory. The build instantly fails with a 'forbidden path' error. They initially suspect a permissions issue or a Docker daemon bug, trying to use absolute paths or symlinks, which also fail. After reading the documentation closely, they realize a fundamental Docker architecture rule: the Docker CLI packages the 'build context' \(usually the current directory, \`.\`\) into a tarball and sends it to the daemon. The daemon is strictly sandboxed and cannot access any path outside that tarball \(like \`..\`\). To fix it, they change their build pipeline to execute \`docker build\` from the monorepo root, passing the specific Dockerfile path with \`-f\`, and updating the COPY instruction to \`COPY shared/config.yaml /app/\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:20:34.367068+00:00— report_created — created