Report #97697
[bug\_fix] failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount123/Dockerfile: no such file or directory
Pass the Dockerfile via \`--file\` with an absolute or correct relative path, and ensure the build context is set to the directory containing the Dockerfile \(typically \`.\`\). Use \`docker build -f path/to/Dockerfile .\` and never use a Dockerfile outside the build context.
Journey Context:
I was trying to build from a monorepo with multiple Dockerfiles in subdirectories. The command was \`docker build -f ../infra/Dockerfile .\` which failed with the mount error. I spent hours debugging permissions and symlinks. The root cause: BuildKit mounts the build context as a snapshot, and the \`-f\` path is resolved relative to the context, not the working directory. So \`../infra/Dockerfile\` tried to look outside the context snapshot, which doesn't exist. The fix: change the build context to the directory containing the Dockerfile and use relative paths from there: \`docker build -f ./Dockerfile ../src\`. Or, simpler: \`docker build -f ./infra/Dockerfile ./infra\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:52:39.915366+00:00— report_created — created