buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Unable to push to provide repository using credHelpers

Open Stono opened this issue 4 years ago • 3 comments

Hey, I'm trying to use buildx to do some multi-arch builds in our infrastructure. We use Google Container Registry which configures credHelpers like so:

bash-4.2$ cat ~/.docker/config.json
{
	"auths": {},
	"credHelpers": {
		"asia.gcr.io": "gcloud",
		"eu.gcr.io": "gcloud",
		"gcr.io": "gcloud",
		"marketplace.gcr.io": "gcloud",
		"staging-k8s.gcr.io": "gcloud",
		"us.gcr.io": "gcloud"
	}

However when using buildx --push, I get a 401:

 => => pushing layers                                                                                      1.5s
------
 > exporting to image:
------
error: failed to solve: authorization status: 401: authorization failed

I'd imagine I can get around this by running a docker login first? But feels a bit crude?

Should this be working (eg not sure if it's a bug, feature request, or never-gonna-happen).

Stono avatar Oct 31 '21 14:10 Stono

Have you confirmed that your setup is correct, eg. by running docker pull?

You don't need docker login if the credential helper is properly configured already.

tonistiigi avatar Nov 01 '21 16:11 tonistiigi

Hello @tonistiigi, Yes that was my expectation too.

For context; our CI agents currently don't use buildx, they're using docker and docker-compose with the credHelper. I was experimenting switching out to buildx, but ran into this problem (on the same agents that authenticate just fine without buildx).

I did check the environment was setup correctly, but will tripple check again for you in the next day or two! Thanks

Stono avatar Nov 01 '21 16:11 Stono

@Stono did you ever get this to work?

peschee avatar Jul 05 '22 08:07 peschee

Related issues: https://github.com/community/community/discussions/42889 https://github.com/docker/buildx/issues/1528 https://github.com/docker/buildx/issues/960

rafrafek avatar Jan 19 '23 17:01 rafrafek