我正在尝试将我的 docker 映像推送到 google 容器映像注册表,但收到一条错误消息,指出我没有执行此操作所需的权限。
我已经尝试过 gcloud auth configure-docker 但它对我不起作用。
我首先使用以下命令构建映像: docker build -t gcr.io/trynew/hello-world-image:v1 。
然后我试图附加一个标签并推送它: docker push gcr.io/trynew/hello-world-image:v1
这是我的输出:
The push refers to repository [gcr.io/trynew/hello-world-image]
e62774cdb1c2: Preparing
0f6265b750f3: Preparing
f82351274ce3: Preparing
31a16430afc8: Preparing
67298499a3ed: Preparing
62d5f39c8fe4: Waiting
9f8566ee5135: Waiting
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) 我的样本问题是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 …Run Code Online (Sandbox Code Playgroud)