Unable to Push to Google Container Registry (unable to access the repository)

烈酒焚心 提交于 2019-12-05 03:41:49

FYI for other customers running into similar issues: https://github.com/docker/docker/issues/22910

There exists a bug with current versions of the Docker client (1.11, 1.12), and the default credential stores which are being enabled on new installations, which break private registries. Removing the

"credsStore": "whatever"

field from your docker config (e.g. ~/.docker/config.json) and running

gcloud docker ...

should fix the issue.

Update:

Alternately, we've implemented a credential helper of our own which solves the problem for our customers (i.e. doesn't get tripped up by the lack of a scheme in the GCR URLs that the Docker client uses to request credentials). To install the credential helper:

  • Download the helper binary and put it on your PATH
  • Execute docker-credential-gcr configure-docker to configure to the Docker client

This sounds like gcloud might not know which project to associate you as.

You can run

gcloud info

to verify which project gcloud is using.

If it doesn't list the project that you are pushing the image under, you can specify it with the --project flag like

gcloud --project= docker push ...

To set the default project for gcloud, you can run

gcloud config set project

Have you run gcloud auth login?

I had this same problem, nothing solved it until I completely removed the folders listed under gcloud info (the install and config directories) then reinstalled the sdk.

Then ran gcloud components install docker-credential-gcr and set that back up. Everything worked.

Just to give an updated answer: I wanted to push to eu.gcr.io. Therefore, I need to authenticate to that registry (took me a while to figure that out).

So first:

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

Second:

 gcloud docker -- push eu.gcr.io/myProjectName/myComputeMachineName

Using cygwin on windows 10 pro (on Hyper-V) and these versions:

$ gcloud --version
Google Cloud SDK 148.0.0
bq 2.0.24
bq-nix 2.0.24
core 2017.03.17
core-nix 2017.02.28
gcloud
gcloud-deps 2017.02.28
gcloud-deps-linux-x86_64 2017.02.28
gsutil 4.23
gsutil-nix 4.22

and

$ docker --version
Docker version 17.03.1-ce-rc1, build 3476dbf

I had the same problem while trying to use GCP on a personal projet :

A look at the activity tab in GCP console showed me that I was trying to push with my professional email address (not allowed on the project) even if I just logged in with my personal one using :

gcloud auth login 

The reason was that I also ran a few months ago this command :

gcloud auth application-default login

with my professional email address.

I just had to run it again, log in with my personal address and everything worked fine !

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!