我正在尝试使用 GCP 的 Cloud Build 构建一个容器。我正在使用来自 quickstart doc 的简单模板.我以前成功地做到了这一点。
但是,这次我使用的是“组织”下的项目。所以项目 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
flag calls docker build -t $TAG .
under the hood和 docker image names use :
to specify versions ,此格式可能无效。在处理组织项目时我应该做什么有什么想法吗?我在 Cloud Build 或 GCP IAM 文档中找不到相关信息。
我尝试过的一些事情:
cloudbuild.yaml
config file与 $PROJECT_ID
substitution确保我有正确的格式 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
关于docker - 使用域范围项目时,云构建中的图像名称无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58045088/