如何将容器推送到 Google Container Registry(无法创建存储库)
How to push container to Google Container Registry (unable to create repository)
编辑:我只是将此归咎于平台不一致。我现在已经放弃推送到 Google Cloud Container Registry,而是创建了一个 Ubuntu VM,我正在这样做。出于前面所述的原因,我也投票结束了这个问题,而且这可能首先应该在服务器故障上被问到。感谢大家的帮助!
运行 $ 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]
注意:这是 的副本,但我尝试了他的解决方案,但对我没有帮助。我试过附加 :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
您似乎正试图从 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
命令
您使用的是什么版本的 gcloud 和 Docker?
查看您的请求,似乎 Docker 客户端没有附加凭据,这可以解释访问被拒绝的原因。
我会推荐 运行 gcloud components update
并查看问题是否重现。如果仍然存在,请随时通过 gcr-contact
google.com
与我们联系,以便我们帮助您调试问题并解决问题。
感谢您添加 Docker 版本信息。将 Docker 降级到更稳定的版本(例如 1.11.2)是否有帮助?你有运行'docker-machine upgrade'吗?
我检查了
gcloud auth list
看到我的应用程序是活动帐户而不是我的个人 Google 帐户。设置后
gcloud config set account example@gmail.com
我能够推动
gcloud docker -- push eu.gcr.io/$PROJECT_ID/my-docker:v1
我仍然无法从本地计算机推送 docker 图像,但是使用我的帐户授权计算实例并从那里推送图像是可行的。如果您 运行 遇到这个问题,我建议您创建一个 Compute Engine 实例(为您自己),使用 gcloud auth
授权一个可以推送容器的帐户,然后从那里推送。我的源代码在 Git 存储库中,我可以从中提取代码。
我遇到了类似的问题,结果发现我必须为该项目启用计费。当您有一个新的 Google 云帐户时,您只能为这么多项目启用计费功能。一旦我这样做了,它就奏效了。
项目的first image push requires admin rights。我在为团队项目将新容器推送到 GCR 时遇到了同样的问题,我可以通过更新我的权限来解决这个问题。
您可能还想看看 docker-credential-gcr。希望对您有所帮助。
这也可能是这个问题的原因(就我而言):
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/
如果有人在尝试将 docker 图像推送到 gcr 时仍然遇到此问题,即使他们已经验证了应该有权这样做的帐户,请尝试 运行 gcloud auth configure-docker
并再次推动。
编辑:我只是将此归咎于平台不一致。我现在已经放弃推送到 Google Cloud Container Registry,而是创建了一个 Ubuntu VM,我正在这样做。出于前面所述的原因,我也投票结束了这个问题,而且这可能首先应该在服务器故障上被问到。感谢大家的帮助!
运行 $ 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]
注意:这是 :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
您似乎正试图从 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
命令
您使用的是什么版本的 gcloud 和 Docker?
查看您的请求,似乎 Docker 客户端没有附加凭据,这可以解释访问被拒绝的原因。
我会推荐 运行 gcloud components update
并查看问题是否重现。如果仍然存在,请随时通过 gcr-contact
google.com
与我们联系,以便我们帮助您调试问题并解决问题。
感谢您添加 Docker 版本信息。将 Docker 降级到更稳定的版本(例如 1.11.2)是否有帮助?你有运行'docker-machine upgrade'吗?
我检查了
gcloud auth list
看到我的应用程序是活动帐户而不是我的个人 Google 帐户。设置后
gcloud config set account example@gmail.com
我能够推动
gcloud docker -- push eu.gcr.io/$PROJECT_ID/my-docker:v1
我仍然无法从本地计算机推送 docker 图像,但是使用我的帐户授权计算实例并从那里推送图像是可行的。如果您 运行 遇到这个问题,我建议您创建一个 Compute Engine 实例(为您自己),使用 gcloud auth
授权一个可以推送容器的帐户,然后从那里推送。我的源代码在 Git 存储库中,我可以从中提取代码。
我遇到了类似的问题,结果发现我必须为该项目启用计费。当您有一个新的 Google 云帐户时,您只能为这么多项目启用计费功能。一旦我这样做了,它就奏效了。
项目的first image push requires admin rights。我在为团队项目将新容器推送到 GCR 时遇到了同样的问题,我可以通过更新我的权限来解决这个问题。
您可能还想看看 docker-credential-gcr。希望对您有所帮助。
这也可能是这个问题的原因(就我而言):
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/
如果有人在尝试将 docker 图像推送到 gcr 时仍然遇到此问题,即使他们已经验证了应该有权这样做的帐户,请尝试 运行 gcloud auth configure-docker
并再次推动。