AWS CodeBuild ECR CannotPullContainerError
AWS CodeBuild ECR CannotPullContainerError
由于以下错误,CodeBuild 项目在配置阶段失败
BUILD_CONTAINER_UNABLE_TO_PULL_IMAGE: Unable to pull customer's container image. CannotPullContainerError: Error response from daemon: pull access denied for <image-name>, repository does not exist or may require 'docker login': denied: User: arn:aws:sts::<id>
问题出在 Image Pull 凭据上。
当 ECRAccessPolicy 附加到项目服务角色时,CodeBuild 使用默认的 AWS CodeBuild 凭证来拉取图像。
我通过更新图像拉取凭据以使用项目服务角色来修复它。
fwiw 我在使用 terraform 创建代码构建管道时偶然发现了这个问题。
为此更改的设置是 image_pull_credentials_type
,在 resource "aws_codebuild_project"
的 environment
块中应将其设置为 SERVICE_ROLE
而不是 CODEBUILD
。
感谢 Chaitanya 的回复,它用公认的答案向我指出了这个方向。
由于以下错误,CodeBuild 项目在配置阶段失败
BUILD_CONTAINER_UNABLE_TO_PULL_IMAGE: Unable to pull customer's container image. CannotPullContainerError: Error response from daemon: pull access denied for <image-name>, repository does not exist or may require 'docker login': denied: User: arn:aws:sts::<id>
问题出在 Image Pull 凭据上。 当 ECRAccessPolicy 附加到项目服务角色时,CodeBuild 使用默认的 AWS CodeBuild 凭证来拉取图像。
我通过更新图像拉取凭据以使用项目服务角色来修复它。
fwiw 我在使用 terraform 创建代码构建管道时偶然发现了这个问题。
为此更改的设置是 image_pull_credentials_type
,在 resource "aws_codebuild_project"
的 environment
块中应将其设置为 SERVICE_ROLE
而不是 CODEBUILD
。
感谢 Chaitanya 的回复,它用公认的答案向我指出了这个方向。