无法从Google计算引擎实例运行gcloud docker Push

问题描述 投票:0回答:2

当我这样做时

gcloud docker push
我收到以下错误。

denied: Unable to create the repository, please check that you have access to do so.

gcloud info
显示 gcloud 中配置的正确项目名称。

有人可以指导我解决这个问题吗?或者提出替代方案。

我尝试过不使用gcloud直接登录,登录成功但推送失败

$docker login -e [email protected] -u oauth2accesstoken  -p "$(gcloud auth print-access-token)" https://gcr.io
Flag --email has been deprecated, will be removed in 1.14.
Login Succeeded
$ docker push gcr.io/project/imagename
...
denied: Unable to create the repository, please check that you have access to do so.

$ gcloud --版本 谷歌云 SDK 147.0.0

$ docker --版本 Docker 版本 17.03.0-ce,内部版本 3a232c8

docker gcloud google-kubernetes-engine google-container-registry
2个回答
6
投票

如果你这样做

gcloud docker -- push gcr.io/X/Y

您需要拥有向名为“X”的 GCP 写入数据的权限。通常,您需要作为项目编辑器添加到该项目。

在这种情况下,GCR 不会抱怨“gcloud info”显示的项目。


0
投票

我知道这是一篇旧帖子。但当我来到这里时却找不到一个好的答案。 gcloud docker -- 18.03 以上的 Docker 客户端已弃用推送。

您需要使用普通的 Docker 推送命令。但在此之前,请先执行以下命令。这将配置 Docker 使用 gcloud 作为凭证助手。

gcloud auth configure-docker

您还会看到一些 URL 将被添加到配置中

 "credHelpers": {
    "gcr.io": "gcloud",
    "us.gcr.io": "gcloud",
    "eu.gcr.io": "gcloud",
    "asia.gcr.io": "gcloud",
    "staging-k8s.gcr.io": "gcloud",
    "marketplace.gcr.io": "gcloud"
  }

之后就可以正常进行了

docker push gcr.io/<project-id/<image>:<tag>
© www.soinside.com 2019 - 2024. All rights reserved.