【问题标题】:How to push container to Google Container Registry (unable to create repository)如何将容器推送到 Google Container Registry(无法创建存储库)
【发布时间】:2016-11-12 04:10:14
【问题描述】:

编辑:我只是将此归咎于平台不一致。我现在已经放弃推送到 Google Cloud Container Registry,而是创建了一个 Ubuntu 虚拟机来代替它。由于前面所述的原因,我也投票结束了这个问题,而且这可能首先应该在服务器故障上被问到。感谢大家的帮助!

运行 $ gcloud docker push gcr.io/kubernetes-test-1367/myapp 会导致:

The push refers to a repository [gcr.io/kubernetes-test-1367/myapp]
595e622f9b8f: Preparing
219bf89d98c1: Preparing
53cad0e0f952: Preparing
765e7b2efe23: Preparing
5f2f91b41de9: Preparing
ec0200a19d76: Preparing
338cb8e0e9ed: Preparing
d1c800db26c7: Preparing
42755cf4ee95: Preparing
ec0200a19d76: Waiting
338cb8e0e9ed: Waiting
d1c800db26c7: Waiting
42755cf4ee95: Waiting
denied: Unable to create the repository, please check that you have access to do so.

$ gcloud init 结果:

Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
[core]
account = <my_email>@gmail.com
disable_usage_reporting = True
project = kubernetes-test-1367
Your active configuration is: [default]

注意:这是Kubernetes: Unable to create repository 的副本,但我尝试了他的解决方案,但对我没有帮助。我试过追加:v1/v1,并使用us.gcr.io

编辑:附加信息

$ gcloud --version
Google Cloud SDK 116.0.0

bq 2.0.24
bq-win 2.0.18
core 2016.06.24
core-win 2016.02.05
gcloud
gsutil 4.19
gsutil-win 4.16
kubectl
kubectl-windows-x86_64 1.2.4
windows-ssh-tools 2016.05.13

+

$ gcloud components update

All components are up to date.

+

$ docker -v
Docker version 1.12.0-rc3, build 91e29e8, experimental

【问题讨论】:

  • 我假设您已经通过控制台或gsutil acl get gs://us.artifacts.kubernetes-test-1367.appspot.com 或类似方式检查了权限?
  • @Idg 给了我这个:BucketNotFoundException: 404 gs://us.artifacts.kubernetes-test-1367.appspot.com bucket does not exist.
  • 是的,如果没有您的请求,我们将不会创建存储桶。

标签: windows docker kubernetes google-cloud-platform google-container-registry


【解决方案1】:

项目的first image push requires admin rights。我在尝试将新容器推送到团队项目的 GCR 时遇到了同样的问题,我可以通过更新权限来解决。

您可能还想看看docker-credential-gcr。希望对您有所帮助。

【讨论】:

    【解决方案2】:

    您使用的是什么版本的 gcloud 和 Docker?

    查看您的请求,Docker 客户端似乎没有附加凭据,这可以解释访问被拒绝。

    我建议运行 gcloud components update 并查看问题是否重现。如果仍然存在,请随时通过gcr-contactgoogle.com 与我们联系,以便我们帮助您调试问题并解决您的问题。

    【讨论】:

    • 我已将我的 Google Cloud 和 Docker 版本添加到我的答案中。 gcloud 报告一切都是最新的。
    • 如果您尝试docker login 命令here 会发生什么? (特别是 oauth2token 之一)
    • 我明白了:Error response from daemon: Get https://us.gcr.io/v1/users/: dial tcp: lookup us.gcr.io on 192.168.65.1:53: read udp 192.168.65.2:35130-&gt;192.168.65.1:53: i/o timeout
    • ping us.gcr.io -4 显示对 74.125.142.82 的成功 ping
    • 192.168.65.2 是本地网络 IP 地址,所以我猜您的路由器或网关是上述真正的问题。我已经看到人们使用 boot2docker / docker-machine 在家庭/工作网络之间移动笔记本电脑。通常重置虚拟机可以解决这个问题,然后再尝试docker login
    【解决方案3】:

    我仍然无法从本地计算机推送 docker 映像,但使用我的帐户授权计算实例并从那里推送映像是可行的。如果您遇到此问题,我建议您创建一个 Compute Engine 实例(为您自己),使用gcloud auth 授权一个可以推送容器的帐户,然后从那里推送。我的源代码位于 Git 存储库中,我可以从中提取代码。

    【讨论】:

    • 我希望我不必这样做。看起来很糟糕。
    • @the0ther 你不知道。作者很可能只允许服务帐户的容器引擎管理员。要推送到注册表,您还需要启用 Cloud Storage 管理员。安德鲁你能证实一下吗(尽管这个问题已经有一年了)?
    • 是的,自从我上次来这里以来,GCR 发生了很大的变化,现在使用它@Overdrivr 完全没有问题。我现在还有其他 Google Cloud 问题。向你们的 Cloud Endpoints 挥舞我的拳头!
    • @the0ther XD 是的,从那以后我就再也没有遇到过这个问题
    【解决方案4】:

    感谢您添加 Docker 版本信息。将 Docker 降级到更稳定的版本(例如 1.11.2)是否有帮助?您是否运行过“docker-machine upgrade”?

    【讨论】:

      【解决方案5】:

      您似乎正在尝试从 Google Compute Engine 实例运行 gcloud docker push,而没有对 Google Cloud Storage 的读/写访问权限的适当安全范围(Google Container Registry 在后台存储您的容器图像)。

      尝试创建另一个实例,但这次使用适当的访问范围,即:

      gcloud compute --project "kubernetes-test-1367" instances create "test" --zone "us-east1-b" --machine-type "n1-standard-1" --network "default" --scopes default="https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management","https://www.googleapis.com/auth/devstorage.full_control" --image "/debian-cloud/debian-8-jessie-v20160629" --boot-disk-size "10" --boot-disk-type "pd-standard" --boot-disk-device-name "test-1"
      

      创建新实例后,通过 ssh 进入该实例,然后尝试重新运行 gcloud docker push gcr.io/kubernetes-test-1367/myapp 命令

      【讨论】:

      • 我在本地机器上运行这个
      【解决方案6】:

      我检查了

      gcloud auth list
      

      查看我的应用程序是活动帐户,而不是我的个人 Google 帐户。设置后

      gcloud config set account example@gmail.com
      

      我可以推

      gcloud docker -- push eu.gcr.io/$PROJECT_ID/my-docker:v1
      

      所以我可以继续http://kubernetes.io/docs/hellonode/

      【讨论】:

      • 很高兴听到您能够解决它,但这对我没有帮助。我的有效帐户已经是我想要的。
      • 70 个打开的浏览器选项卡,我仍然无法决定是否应该能够从我的笔记本电脑推送到 GCR,或者我是否必须在 Google Cloud 中启动一个盒子来推送到 GCR .
      • 我已经从我的笔记本电脑上推送了
      【解决方案7】:

      我遇到了类似的问题,结果我必须为该项目启用计费功能。当您拥有一个新的 Google Cloud 帐户时,您只能启用这么多的计费项目。一旦我这样做了,它就起作用了。

      【讨论】:

      • 不知道为什么这篇文章被否决,但在我的情况下,我跳过了计费设置,我无法部署,最后我完成了计费设置并将其链接到我的项目之后,我可以部署它成功,投赞成票
      【解决方案8】:

      这也可能是导致此问题的原因(就我而言):

      Important: make sure the Compute Engine API is enabled for your project on the

      来源:https://pinrojas.com/2016/09/12/your-personal-kubernetes-image-repo-in-a-few-steps-gcr-io/

      【讨论】:

        【解决方案9】:

        如果有人在尝试将 docker 映像推送到 gcr 时仍然遇到此问题,即使他们已经验证了应该有权这样做的帐户,请尝试运行 gcloud auth configure-docker 并再次推送。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2017-11-09
          • 2016-07-06
          • 2020-04-23
          • 2019-05-29
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多