Report #36739
[bug\_fix] ERROR: failed to solve: failed to fetch oauth token... unauthorized: authentication required
Pass \`--network=host\` to the \`docker build\` command, or ensure BuildKit has access to the Docker config by passing it as a secret.
Journey Context:
A CI pipeline logs into a private AWS ECR registry using \`docker login\` and then runs a multi-stage Docker build that pulls a base image from that registry. The build fails with an unauthorized error. The developer is baffled because \`docker pull\` works fine on the host. The root cause is that BuildKit runs as a separate daemon \(or container, like in GitHub Actions\) and does not share the host's Docker credential store by default. It cannot access the auth token. Using \`--network=host\` allows BuildKit to resolve local auth mechanisms, or passing the \`.docker/config.json\` as a build secret explicitly grants it access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:08:33.813744+00:00— report_created — created