无法推送到Google Container Registry-权限问题 [英] Unable to push to Google Container Registry - Permission issue

查看:371
本文介绍了无法推送到Google Container Registry-权限问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的示例问题为 Vaclav .我遵循了GCR的快速入门,这封信要求创建一个新项目(称为gcr-project)并复制Flask(python)应用程序的代码.

I'm having the sample problem as Vaclav. I've followed the GCR quick start to the letter which entailed creating a new project (called gcr-project) and copying the code for a Flask (python) app.

构建docker映像后,我输入了命令:

After building the docker image, I entered the commands:

gcloud auth configure-docker
docker tag quickstart-image gcr.io/gcr-project/quickstart-image:tag1
docker push gcr.io/gcr-project/quickstart-image:tag1

答复为:

unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

因此,很高兴知道问题是否出在凭据(我正在对其他项目使用Cloud SDK OK)或权限方面. 此处文档建议您需要存储管理员权限,但项目已经拥有它,请参见屏幕截图此处

So it would be nice to know if the issue is with the credentials (I'm using cloud SDK OK for other projects) or permissions. The documentation here suggests you need storage-admin rights but the projects already has it, see screen cap here

在我寻求使用GCR的过程中,将感谢您为解决此问题提供的所有提示,但是这个问题对我来说是很难的.

Would appreciate any tips for trouble shooting this as I was looking for to using the GCR but this problem is a hard stop for me.

更新: 我用云外壳尝试了相同的过程

UPDATE: I tried the same process with the cloud shell

me@cloudshell:~ (gcr-project-XXXXXX)$ docker push gcr.io/gcr-project/quickstart-image:tag1
The push refers to repository [gcr.io/gcr-project/quickstart-image]
4399528b7213: Preparing
1d10b1eeca74: Preparing
75156020d862: Preparing
c5697656a146: Preparing
2a435270de82: Preparing
c35f70b5c25a: Waiting
28e260baaf1b: Waiting
556c5fb0d91b: Waiting

denied: Token exchange failed for project 'gcr-project'. Please enable Google Container Registry API in Cloud Console at https://console.cloud.google.com/apis/api/containerregistry.googleapis.com/overview?project=gcr-project before performing this operation.
me@cloudshell:~ (gcr-project-XXXXXX)$

这提示我检查API&服务信息中心,以确认已启用容器注册表API-是.

This prompted me to check the API & Services dashboard to confirm the container-registry API was enabled - It is.

更新2: 我在运行ubuntu 19.04的计算机上遇到这些问题.根据下面的评论,我能够通过cloud shell进行推送.因此,我随后在MacBook Pro上进行了相同的练习-没问题.

UPDATE 2: I'm having these problems on a machine running ubuntu 19.04. Per the comments below I was able to do a push via the cloud shell. So I then went through the same exercise on a MacBook Pro - worked no problems.

因此,我随后按照使用过的doco卸载了 以前的标准 Linux安装说明.然后,我使用 debian-ubuntu安装说明(版本274.0.1-0)...仍然不行.

So I then uninstalled Cloud SDK per the doco having used the standard linux install instructions previously. I then re-installed using the debian-ubuntu install instructions (version 274.0.1-0)... STILL no go.

当我在码头上拉映像时(由于推在MBP上起作用),我收到此错误:Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

When I do a docker pull on the image (because push worked on MBP) I get this error: Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

当我进行推送时,出现以下错误:unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

And when I do a push I get this error: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

因此,在此阶段,考虑到MBP的成功以及linux/ubuntu机器上缺少MBP的问题,问题仅限于linux/ubuntu安装.

So at this stage, given the success on the MBP and the lack thereof on the linux/ubuntu machine, the problem is constrained to to linux/ubuntu installs.

更新3: 我进入一个单独的ubuntu服务器,使用sudo snap install google-cloud-sdk --classic进行了干净安装,按照文档进行了其他所有操作,仍然遇到了完全相同的问题.因此,我确定这是Linux google cloud SDK的特定问题.

UPDATE 3: I got on to a separate ubuntu server, did a clean install with sudo snap install google-cloud-sdk --classic , did everything else per the docs and still had the exact same problem. So I recon this is a linux google cloud SDK specific problem.

最近有没有人能够在GCR上安装和使用Cloud SDK ???????

Is there anyone out there Ubuntu land who as been able install and use cloud SDK with GCR recently?????????

推荐答案

我能够在多台ubuntu计算机上复制此问题.在最新的Cloud SDK更新(276.0.0)之后,我再次尝试,但是没有运气.

I was able to replicate this issue on multiple ubuntu machines. I tried again after the most recent cloud SDK update (276.0.0) but had no luck.

最后,我使用了json密钥文件authentincati 中所述此处的文档,因为它可以很好地工作.

In the end I went with json key file authentincati described in the docs here as a work around which worked fine.

这篇关于无法推送到Google Container Registry-权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆