docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit
Apache License 2.0
3.55k stars 481 forks source link

Unable to push to provide repository using credHelpers #819

Open Stono opened 3 years ago

Stono commented 3 years ago

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).

tonistiigi commented 3 years ago

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.

Stono commented 3 years ago

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

peschee commented 2 years ago

@Stono did you ever get this to work?

rafrafek commented 1 year ago

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