Report #2862
[bug\_fix] COPY failed: forbidden path outside the build context: ../../some-dir \(\)
Move any files the image needs into the build-context directory, or use a named context with \`--build-context name=path\` and reference it via \`COPY --from=name\`. Do not rely on \`../\` relative paths that leave the context root; the legacy builder rejects them and BuildKit silently strips the parent traversal.
Journey Context:
A developer had a monorepo layout where the Dockerfile lived in \`docker/Dockerfile\` and wanted to copy a shared config from the parent directory with \`COPY ../config.yml /config.yml\`. Locally, with BuildKit, the build unexpectedly copied a different file because \`../\` was stripped. On the CI runner using an older Docker daemon, it failed outright with the forbidden-path error. The fix was to run the build from the repository root and use the root as context, then copy the dockerfile-specific files with explicit paths, which made the build deterministic on both old and new Docker versions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T14:31:03.742491+00:00— report_created — created