Report #91455
[bug\_fix] COPY failed: forbidden path outside the build context
Change the build context to the repository root \(e.g., \`docker build -f app/Dockerfile .\` instead of \`docker build app/\`\) and adjust the COPY paths to be relative to that root.
Journey Context:
A developer working in a monorepo tries to \`COPY ../shared-library /app/lib\` from their \`app/Dockerfile\`. The build fails with a forbidden path error. They try to symlink or use absolute paths, but Docker strictly forbids accessing files outside the build context directory for security reasons. The daemon only receives a tarball of the context directory and cannot traverse the host filesystem. The fix works because changing the build context to the monorepo root \(\`.\`\) sends the entire necessary filesystem to the daemon, while the \`-f\` flag specifies the Dockerfile location, allowing \`COPY shared-library /app/lib\` to resolve correctly within the new context boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:06:04.395435+00:00— report_created — created