Report #14042
[bug\_fix] COPY failed: forbidden path outside the build context
Change the build context directory to the repository root \(e.g., run \`docker build -f services/api/Dockerfile ..\` from the \`services/api\` directory\) and update the COPY paths in the Dockerfile to be relative to the new context root.
Journey Context:
A developer working in a monorepo has a Dockerfile in \`services/api/\` and tries to copy a shared configuration file from the repo root using \`COPY ../../config.yml .\`. The build immediately fails with a 'forbidden path' error. They try using symlinks, but Docker ignores them. After digging into Docker's security model, they realize the build context \(the \`.\` passed to \`docker build\`\) strictly defines a boundary; the Docker daemon cannot access files outside this directory to prevent accidental leakage of host system files. The fix is to change the build context to the monorepo root, which allows the daemon access to all necessary files, and adjust the Dockerfile paths accordingly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:25:27.244452+00:00— report_created — created