[英]Automatically deploy new container to Google Cloud Compute Engine from Google Container Registry
[英]Cannot access Google Container Registry from Google Compute Engine
我正在尝试将 Docker 映像从 Google Container Registry 获取到 Google Compute Engine 实例上。 (我需要的图片已经成功上传到GCR。)
我已经使用gcloud auth login
,然后尝试gcloud docker pull -- us.gcr.io/app-999/app
这导致ERROR: (gcloud.docker) Docker is not installed.
.
我尝试使用oauth进行身份验证并通过普通的 docker 调用进行拉取。 当我查看.docker/config.json
中的文件时,我会看到我的凭据。 这样做,看起来它会起作用,但最终会像这样结束:
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
这看起来像是进步,因为至少它试图下载一些东西。
我也在我的本地机器上尝试了这两种方法,两种方法都成功了。
我错过了什么吗?
谢谢你的帮助。
PS 我还尝试从另一个注册表(Docker Hub)加载一个容器,效果很好,但我需要多个容器,并希望降低费用。
联系 Google 支持后,他们通知我gcloud
别名中存在错误。 这个错误是通过覆盖 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'
我已经试过了,现在可以用了。
docker
应包括在最新版本的gcloud
。 您可以通过运行gcloud components update
更新到最新版本的gcloud
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.