简体   繁体   中英

Cannot access Google Container Registry from Google Compute Engine

I'm at my wits trying to get Docker images from Google Container Registry onto a Google Compute Engine instance. (The images I need have been successfully uploaded to GCR.)

  1. I've logged in using gcloud auth login and then tried gcloud docker pull -- us.gcr.io/app-999/app which results in ERROR: (gcloud.docker) Docker is not installed. .

  2. I've tried to authenticate using oauth and pulling via a normal docker call. I see my credentials when I look at the file at .docker/config.json . Doing that, it looks like it's going to work, but ultimatly ends like this:

    mbname@instance-1 ~ $ docker pull -- us.gcr.io/app-999/app Using default tag: latest latest: Pulling from app-999/app b7f33cc0b48e: Pulling fs layer 43a564ae36a3: Pulling fs layer b294f0e7874b: Pulling fs layer eb34a236f836: Waiting error pulling image configuration: unauthorized: authentication required

which looks like progress, because at least it attempted to download something.

I've tried both of these things on my local machine as well and both methods were successful.

Am I missing something?

Thanks for your help.

PS I've also tried loading a container from another registry ( Docker Hub) and that worked fine, but I need more than one container and want to keep expenses down.

After contacting Google support they informed me that there is a bug in the CoreOS gcloud alias. This bug is fixed by overwriting the alias in the shell as follows:

alias gcloud='(docker images google/cloud-sdk || docker pull google/cloud-sdk) > /dev/null;docker run -t -i --net=host -v $HOME/.config:/.config -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker google/cloud-sdk gcloud'

I've tried this and it works now.

docker should be included in the latest versions of gcloud . You can update to the latest version of gcloud by running gcloud components update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM