Report #27570
[bug\_fix] ERROR: failed to solve: failed to fetch oauth token ... unauthorized: authentication required
Use the default \`docker\` builder, or pass the Docker config to the \`docker-container\` builder using \`docker buildx create --name mybuilder --driver docker-container --config buildkitd.toml\` or by logging in within the builder container context.
Journey Context:
A developer sets up \`docker buildx\` to build multi-architecture images. They create a new builder using \`docker buildx create --name mybuilder --driver docker-container\`. They authenticate with a private registry using \`docker login\`. When they run \`buildx build\`, it fails with 'unauthorized'. The developer is baffled because \`docker pull\` works fine. The rabbit-hole reveals that the \`docker-container\` driver runs BuildKit inside a separate container. This isolated container does NOT automatically mount or read the host's \`~/.docker/config.json\` where the auth tokens are stored. The fix is to either use the default \`docker\` builder \(which runs BuildKit inside the existing Docker daemon and shares its auth\), or to explicitly configure the \`docker-container\` builder to use the host's credentials by passing the config directory, or by using a BuildKit config TOML file that specifies registry credentials/mirrors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:40:27.074220+00:00— report_created — created