docker - 使用域范围项目时,云构建中的图像名称无效
问题描述
我正在尝试使用 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 文档中找不到相关信息。
我尝试过的一些事情:
- 使用带有替换的
cloudbuild.yaml
配置文件来确保我的格式正确$PROJECT_ID
- 使用项目编号而不是项目 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 Editor
和Cloud Run Invoker
角色,前者指定我可以“创建和取消构建”
解决方案
您需要将“:”替换为“/”
gcloud builds submit --tag gcr.io/mycompany.com/project-id/helloworld
更多信息可以在这里找到:https ://cloud.google.com/container-registry/docs/overview#domain-scoped_projects
推荐阅读
- angular - 如何水平间隔一个垫子复选框和它的标签?
- svn - 无法删除 svn 更改列表
- ios - UIVisualEffectView 的渐变蒙版
- qt - 从模型中访问委托的输入值
- android - Gitlab Ci :app:checkDebugDuplicateClasses 错误
- javascript - 如何从 php 标签内的 api(javascript) 打印返回变量?
- grafana - Grafana 堆栈线图显示值为 0 的隐藏系列
- c# - 我该怎么做才能解决封闭类型错误?
- graph - 如何过滤某些节点以发现路径
- c# - C# MVC5 Jquery 自动完成,返回 JSON 数据失败