Report #97722
[bug\_fix] COPY failed: forbidden path outside the build context: \(\)
Move the needed file inside the build context and use a relative path, or use BuildKit's \`RUN --mount=type=bind,source=,target=\` with \`docker buildx build\`. Root cause: Dockerfile COPY and ADD can only read files inside the build context directory passed to the build command; paths escaping that directory are rejected for reproducibility and security.
Journey Context:
Your repo has \`services/api/Dockerfile\` and a shared \`config/settings.yaml\` one directory above. You write \`COPY ../config/settings.yaml /app/config/\` and the build fails with "forbidden path outside the build context". You try an absolute path and get the same error. You learn the build context is a tarball of the directory supplied to \`docker build\`, and the Dockerfile frontend forbids escaping it. You move the Dockerfile to the repository root and adjust the COPY source to \`config/settings.yaml\`, or switch to a BuildKit bind mount, and the build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:35:02.314111+00:00— report_created — created