Gcloud docker push 403 Forbidden

I try to push the docker image to eu.gcr.io and I get 403 Forbidden

gcloud docker push eu.gcr.io/<projectname>/<image>:latest The push refers to a repository [eu.gcr.io/<projectname>/<image>] (len: 1) 663cd9de01fe: Preparing Post https://eu.gcr.io/v2/w<projectname>/<image>/blobs/uploads/: token auth attempt for registry: https://eu.gcr.io/v2/token?account=_token&scope=repository%3A<projectname>%2F<image>3Apush%2Cpull&service=eu.gcr.io request failed with status: 403 Forbidden 

I checked

  • curl https://eu.gcr.io/v1/_ping => works
  • gcloud config list => id of setup project
  • Storage api enabled in console
  • If I use the project name in the url, I get 403 Forbidden
  • If I use the project id in the url, I get "Repository does not exist"
  • gcloud auth list => shows the owner as active
  • Updating gcloud components => All components are updated.
+5
source share
2 answers

I ran into the same problem in order to solve it so that I do it.

 docker login -e 1234@5678.com -u _token -p "$(gcloud auth print-access-token)" https://gcr.io 

(When using sudo docker token will be saved with the root account.)

Then use docker push gcr.io/projetc_id/imagename according to How to transfer the docker image to a private repository

+3
source

It seems that the problem is that the (local) docker tag was incorrect, the tag was the "project name" instead of the "gcloud project id", therefore, changing the tag to the containing project, click.

+3
source

Source: https://habr.com/ru/post/1240935/


All Articles