Docker image build failures — failed to solve / failed to compute cache key
Log signatures
failed to solve failed to compute cache key target stage could not be found manifest unknown: manifest not found service db is unhealthy
What’s happening
BuildKit's "failed to solve" is a wrapper — the real cause is the line after it. The recurring four: (1) "failed to compute cache key" + "/x: not found" — a COPY source doesn't exist in the build context, usually because .dockerignore excludes it or CI builds from a different context directory than you do locally; (2) "target stage ... could not be found" — a typo'd or renamed FROM ... AS <stage> vs --target <stage>; (3) "manifest ... not found" — the base image tag doesn't exist (deleted upstream, or no build for your platform — check --platform on multi-arch); (4) "service ... is unhealthy" — compose-specific: the image built fine but a healthcheck never went green, so the real log is the service's log, not the build log.
Fix playbook
- 1Read the line after failed to solve — that's the actual error.
- 2COPY failures: print the context as CI sees it (ls -la in the same directory the build runs from) and check .dockerignore. The file exists in the repo; it doesn't exist in the context.
- 3manifest not found: confirm the tag exists for your platform (docker manifest inspect <image>); pin a digest if the tag churns.
- 4service is unhealthy: get the service's own output (docker compose logs <service>) and triage that — the compose error is just the timeout notification. Check the healthcheck timing.
- 5Reproduce locally with the same context dir, same --target, same --platform as CI before touching the Dockerfile.
Prevention
- Pin base images by digest (FROM image@sha256:...) for anything that ships; tags are mutable and latest is a time bomb.
Triage every red build, not just this one.
This page is one of 31 failure classes the open-source patchrail CLI matches from a raw log — locally, with secrets redacted first. If a log stumps it, open an issue; if it saves you a debugging morning, a star helps other maintainers find it.
pipx install patchrail