gcr.io registry, docker buildx multi-plaftorm --push 401: authorization failed

814 views Asked by At

I'm facing an unauthorized issue when using docker buildx build --platform linux/amd64 -f Dockerfile -t gcr.io/<bucket>/<image>:1.0.0 --push . when pushing to gcr.io/<bucket>. I listed one platform here, but the problem is the same with multiple platforms.

However, it works when doing a --load action followed by a manual docker push:

docker buildx build --platform linux/amd64 -f Dockerfile -t gcr.io/<bucket>/<image>:1.0.0 --load .
docker push gcr.io/<bucket>/<image>:1.0.0

What is the proper configuration I need to be able to use docker buildx build with --push directly to push to a GCR registry? I'm authenticated to GCP with gcloud auth login and did gcloud auth configure-docker. The standard docker push works so I assume the configuration is good for this use case.

If you don't know the answer but know how where I could get support from GCR team about this, please post the link in a comment and I'll follow up there to see what's wrong.

Some information about my setup:

$ gcloud --version
Google Cloud SDK 377.0.0
alpha 2022.03.10
bigtable
bq 2.0.74
cbt 0.11.0
core 2022.03.10
gsutil 5.8
kubectl 1.21.9
minikube 1.25.2
$ docker version
Client:
 Cloud integration: v1.0.22
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:46:56 2021
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:07 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
0

There are 0 answers