Report #94536
[bug\_fix] COPY failed: forbidden path outside the build context
Move all required files into the build context directory, or change the build context root passed to \`docker build\`. Do not use relative paths like \`../\` in COPY commands.
Journey Context:
A developer is working in a monorepo. Their Dockerfile is in \`services/api/\`. They try to copy a shared library using \`COPY ../../libs/shared ./shared\`. The build fails with a forbidden path error. They try using a symlink, but Docker resolves it outside the context or ignores it. They realize Docker security constraints strictly forbid copying files from outside the build context directory \(the path passed as the last argument to \`docker build\`\). To fix this, they change their CI script to run \`docker build\` from the repository root \(\`docker build -f services/api/Dockerfile .\`\), and update the Dockerfile COPY instruction to \`COPY libs/shared ./shared\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:15:49.562572+00:00— report_created — created