无法推送到 Google Container Registry - 权限问题

Lau*_*bba 3 google-container-registry

我的样本问题是Vaclav。我已经按照 GCR 快速入门开始了这封信,其中需要创建一个新项目(称为 gcr-project)并复制 Flask(python)应用程序的代码。

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

gcloud auth configure-docker
docker tag quickstart-image gcr.io/gcr-project/quickstart-image:tag1
docker push gcr.io/gcr-project/quickstart-image:tag1
Run Code Online (Sandbox Code Playgroud)

回应是:

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
Run Code Online (Sandbox Code Playgroud)

因此,很高兴知道问题是与凭据(我正在为其他项目使用云 SDK OK)还是权限有关。此处的文档建议您需要存储管理员权限,但项目已经拥有该权限,请参阅此处的屏幕截图

我很感激任何解决此问题的提示,因为我正在寻找使用 GCR 的方法,但这个问题对我来说很难。

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

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)$
Run Code Online (Sandbox Code Playgroud)

这促使我检查 API 和服务仪表板以确认容器注册表 API 已启用 - 确实如此。

更新 2: 我在运行 ubuntu 19.04 的机器上遇到这些问题。根据下面的评论,我能够通过云外壳进行推送。所以我在 MacBook Pro 上进行了同样的练习 - 没有问题。

因此,我根据之前使用标准linux 安装说明的 doco卸载了 Cloud SDK 。然后我使用debian-ubuntu 安装说明(版本 274.0.1-0)重新安装......仍然不行。

当我对图像执行 docker pull 操作时(因为推送适用于 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

当我执行推送时,我收到此错误: 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 机器上的缺乏,问题仅限于 linux/ubuntu 安装。

更新 3: 我使用了一个单独的 ubuntu 服务器,使用 进行了全新安装sudo snap install google-cloud-sdk --classic,按照文档进行了其他所有操作,但仍然遇到完全相同的问题。所以我认为这是一个 linux google cloud SDK 特定问题。

有没有人最近能够安装和使用带有 GCR 的云 SDK 的 Ubuntu 土地?????????

Lau*_*bba 10

我能够在多台 ubuntu 机器上复制这个问题。我在最近的云 SDK 更新 (276.0.0) 后再次尝试,但没有成功。

最后,我使用了此处文档中描述的json 密钥文件 authentincati作为一种工作正常的解决方法。

  • 我在 Ubuntu 18.04 LTS 上也遇到了同样的问题。现在似乎有一个错误。 (2认同)