使用域范围的项目时,云构建中的图像名称无效
invalid image name in cloud build when using domain-scoped project
我正在尝试使用 GCP 的 Cloud Build 构建容器。我正在使用 quickstart doc 中的简单模板。我之前成功地做到了这一点。
不过,这次我使用的是"organization"下的项目。所以项目 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 and docker image names use :
to specify versions,这个格式可能是无效的。
知道我在处理组织项目时应该做什么吗?我在 Cloud Build 或 GCP IAM 文档中找不到相关信息。
我尝试过的一些东西:
- 使用
cloudbuild.yaml
config file with a $PROJECT_ID
substitution 确保格式正确
- 使用项目编号而不是项目 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
角色,前者指定我可以 "create and cancel builds"
你可以通过 运行:
gcloud beta run deploy --image gcr.io/replica-20584682/helloworld --platform managed
现在默认情况下所有项目都在一个组织下,项目 ID 在全球范围内是唯一的here它解释了这一点。
由于它在部署时在全球范围内是唯一的,因此您无需提及组织。
编辑
添加了标志 --platform managed
您需要将“:”替换为“/”
gcloud builds submit --tag gcr.io/mycompany.com/project-id/helloworld
可以在此处找到更多信息:https://cloud.google.com/container-registry/docs/overview#domain-scoped_projects
我正在尝试使用 GCP 的 Cloud Build 构建容器。我正在使用 quickstart doc 中的简单模板。我之前成功地做到了这一点。
不过,这次我使用的是"organization"下的项目。所以项目 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 and docker image names use :
to specify versions,这个格式可能是无效的。
知道我在处理组织项目时应该做什么吗?我在 Cloud Build 或 GCP IAM 文档中找不到相关信息。
我尝试过的一些东西:
- 使用
cloudbuild.yaml
config file with a$PROJECT_ID
substitution 确保格式正确 - 使用项目编号而不是项目 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
角色,前者指定我可以 "create and cancel builds"
你可以通过 运行:
gcloud beta run deploy --image gcr.io/replica-20584682/helloworld --platform managed
现在默认情况下所有项目都在一个组织下,项目 ID 在全球范围内是唯一的here它解释了这一点。
由于它在部署时在全球范围内是唯一的,因此您无需提及组织。
编辑
添加了标志 --platform managed
您需要将“:”替换为“/”
gcloud builds submit --tag gcr.io/mycompany.com/project-id/helloworld
可以在此处找到更多信息:https://cloud.google.com/container-registry/docs/overview#domain-scoped_projects