所以我将我的 docker 镜像上传到我的项目注册表。我可以导航到https://console.cloud.google.com/gcr/images/并且我看到我的图片在那里列出。
现在我想在这个项目上运行一个虚拟机,在这个项目上使用 docker 来运行这个图像。
这是我的 VM 中的命令:
sudo /usr/bin/docker run eu.gcr.io/my-project-name/example001
回应是:
Unable to find image 'eu.gcr.io/.../example001:latest' locally
/usr/bin/docker: Error response from daemon: unauthorized: You don't have the needed permissions to perform this op
eration, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.goo
gle.com/container-registry/docs/advanced-authentication.
See '/usr/bin/docker run --help'.
请参阅所附图片。如果我将“eu.gcr.io/...”定义为我的项目路径,我可以列出我的图像。但是机器似乎在“.gcr.io”上运行,因此无法访问我的图像?我将如何解决这个问题 - 为什么我的图像在“eu.gcr.io”上而机器在“.gcr.io”上,我找不到改变它的方法(将图像移动到 gcr.io 或移动机到,eu.gcr.io)。但是我不确定这是否是问题。
VM 基本上不能在“.gcr.io”上,它可以在非欧洲地区/地区运行,但应该没有问题。
从 GCP 访问控制的角度来看,注册表只是一个存储桶。所以我相信您首先需要检查的是 VM 是否可以访问 Google Cloud Storage。使用 gcloud:
gcloud compute instances describe <instance-name>
检查 VM 是否具有从 devstorage 读取的范围:
服务帐户: - 电子邮件:[email protected] 范围: - https://www.googleapis.com/auth/devstorage.read_only - ...
这个范围应该到位以从注册表中读取:
如果您在 VM 上没有这样的范围,但配置了 gcloud,则可以使用 gcloud 作为凭证助手:
gcloud auth configure-docker
如您提到的文档中所述:https : //cloud.google.com/container-registry/docs/advanced-authentication#gcloud_as_a_docker_credential_helper
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句