Report #16176
[bug\_fix] ERROR: failed to solve: failed to compute cache key: failed to walk context: lstat : file does not exist \(in Docker Compose\)
Set the \`context\` in \`docker-compose.yml\` to the repository root \(or the directory containing all required files\), and set \`dockerfile\` to the relative path to the Dockerfile from that root.
Journey Context:
A developer has a monorepo with a \`docker-compose.yml\` in the root. They define a service with \`build: context: ./services/api dockerfile: Dockerfile\`. The Dockerfile tries to \`COPY ../../proto/ ./proto/\`. The Compose build fails with a context walk error. The developer tries adjusting the \`COPY\` path, but Docker's context boundary blocks it. They realize the \`context\` key in Compose defines the boundary of what is sent to the Docker daemon, exactly like the \`docker build\` command path. Changing the context to \`.\` \(the repo root\) and the dockerfile to \`services/api/Dockerfile\` works because it expands the build context to include the entire repository, allowing the Dockerfile to access files outside its immediate directory while maintaining a reproducible Compose configuration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:57:30.889412+00:00— report_created — created