首页 > 解决方案 > 使用域范围项目时,云构建中的图像名称无效

问题描述

我正在尝试使用 GCP 的 Cloud Build 构建一个容器。我正在使用快速入门文档中的简单模板。我之前成功地做到了这一点。

但是,这一次我使用的是一个“组织”下的项目。所以项目ID是mycompany.com:projectX,而不是简单projectX的。

我无法完成构建。

当我运行时:

gcloud builds submit --tag gcr.io/mycompany.com:project-id/helloworld

我收到以下错误:

(gcloud.builds.submit) INVALID_ARGUMENT: invalid build: invalid image name "gcr.io/mycompany.com:projectX/helloworld" 

我怀疑由于--tag标志调用docker build -t $TAG .docker图像名称用于:指定版本,这种格式可能是无效的。

在处理组织项目时我应该做什么的任何想法?我在 Cloud Build 或 GCP IAM 文档中找不到相关信息。

我尝试过的一些事情:

标签: dockergoogle-cloud-platformcloudgoogle-cloud-buildgoogle-iam

解决方案


您需要将“:”替换为“/”

gcloud builds submit --tag gcr.io/mycompany.com/project-id/helloworld

更多信息可以在这里找到:https ://cloud.google.com/container-registry/docs/overview#domain-scoped_projects


推荐阅读