Report #51093
[bug\_fix] \`COPY failed: forbidden path outside the build context: ../config.json\`
Move the Dockerfile to the project root, or adjust the \`docker build\` context path \(e.g., \`docker build -f subdir/Dockerfile ..\`\), and update the COPY paths to be relative to the new context root.
Journey Context:
A developer organizes their project into subdirectories: frontend/ and backend/, each with their own Dockerfile. The backend needs a shared config file from the project root \(\`../config.json\`\). The build fails immediately with a forbidden path error. They try using absolute paths, symlinks, or changing WORKDIR, but nothing works. They eventually realize that Docker clients send a build context \(a tarball of files\) to the daemon. The daemon cannot access files outside this tarball for security and portability reasons. The fix is to run the build command from the project root \(\`docker build -f backend/Dockerfile .\`\) and change the Dockerfile COPY instruction to \`COPY config.json /app/\`, making it relative to the root context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:14:52.157083+00:00— report_created — created