Report #56211
[bug\_fix] COPY failed: forbidden path outside the build context: ..
Move the required files into the build context directory, or change the build context root to the parent directory \(e.g., \`docker build -f subdir/Dockerfile .\` instead of \`docker build -f subdir/Dockerfile subdir\`\).
Journey Context:
In a monorepo setup, a developer tries to copy a shared configuration file from a sibling directory using \`COPY ../shared/config.yaml .\` inside their Dockerfile. The build fails with a 'forbidden path' error. They attempt to use symlinks, but Docker resolves them outside the context or ignores them. The debugging process reveals that the Docker client only sends the specified build context directory to the daemon, and for security, the daemon cannot access files outside that tarball. The fix works because by setting the build context to the monorepo root \(\`.\`\), the entire repository is sent to the daemon, making \`COPY shared/config.yaml .\` \(adjusted path\) valid and secure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:50:36.336028+00:00— report_created — created