使用域范围的项目时,云构建中的映像名称无效 [英] invalid image name in cloud build when using domain-scoped project

查看:116
本文介绍了使用域范围的项目时,云构建中的映像名称无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用GCP的Cloud Build构建一个容器.我正在使用快速入门文档中的简单模板.我已经成功完成了此操作.

I'm trying to build a container with GCP's Cloud Build. I'm using the simple template from the quickstart doc. I've done this before successfully.

但是,这次我使用的是组织"下的项目.因此,项目ID是mycompany.com:projectX,而不是简单的projectX.

However, this time I am using a project which is under an "organization". So the project ID is mycompany.com:projectX, rather than simply 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镜像名称使用:来指定版本,此格式可能无效.

I suspect that since the --tag flag calls docker build -t $TAG . under the hood and docker image names use : to specify versions, this format may be invalid.

有什么想法在处理组织项目时应该做什么?我无法在Cloud Build或GCP IAM文档中找到相关信息.

Any ideas what I am supposed to do when working with organization projects? I cannot find relevant info in the Cloud Build or GCP IAM docs.

我尝试过的一些事情:

  • 使用带有 cloudbuild.yaml配置文件 > 替代,以确保我拥有正确的格式
  • 使用项目编号代替项目ID(Using the project number in the image path is not supported. Project ID must be used instead)
  • 完全省略组织名称,Token exchange failed for project
  • 拒绝了该组织名称
  • 检查我的权限-我具有Cloud Build EditorCloud Run Invoker角色,其中前者指定我可以创建和取消构建"
  • using a cloudbuild.yaml config file with a $PROJECT_ID substitution to ensure I have the correct format
  • using the project number instead of the project ID (Using the project number in the image path is not supported. Project ID must be used instead)
  • omitting the organization name altogether, which is denied with Token exchange failed for project
  • checking my permissions - I have Cloud Build Editor and Cloud Run Invoker roles, where the former specifies that I can "create and cancel builds"

推荐答案

您需要将:"替换为"/"

You need to replace the ":" with a "/"

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

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

More info can be found here: https://cloud.google.com/container-registry/docs/overview#domain-scoped_projects

这篇关于使用域范围的项目时,云构建中的映像名称无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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