[英]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.我正在尝试将 Docker 映像从 Google Container Registry 获取到 Google Compute Engine 实例上。 (The images I need have been successfully uploaded to GCR.) (我需要的图片已经成功上传到GCR。)
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.
我已经使用gcloud auth login
,然后尝试gcloud docker pull -- us.gcr.io/app-999/app
这导致ERROR: (gcloud.docker) Docker is not installed.
. .
I've tried to authenticate using oauth and pulling via a normal docker call.我尝试使用oauth进行身份验证并通过普通的 docker 调用进行拉取。 I see my credentials when I look at the file at .docker/config.json
.当我查看.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. PS 我还尝试从另一个注册表(Docker Hub)加载一个容器,效果很好,但我需要多个容器,并希望降低费用。
After contacting Google support they informed me that there is a bug in the CoreOS gcloud
alias.联系 Google 支持后,他们通知我gcloud
别名中存在错误。 This bug is fixed by overwriting the alias in the shell as follows:这个错误是通过覆盖 shell 中的别名来修复的,如下所示:
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
. docker
应包括在最新版本的gcloud
。 You can update to the latest version of gcloud
by running gcloud components update
您可以通过运行gcloud components update
更新到最新版本的gcloud
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.