3

我使用以下命令确认这aws/codebuild/java:openjdk-8是精选的 CodeBuild 映像之一。

$ aws codebuild list-curated-environment-images | grep -A 1 openjdk-8
"name": "aws/codebuild/java:openjdk-8", 
"description": "AWS CodeBuild - Java 8"

尽管aws/codebuild/java:openjdk-8是经过策划的映像,但当我尝试使用该映像和 PrivilegedMode=true 参数创建构建项目时,我收到一个没有意义的 4XX 错误:“只能为自定义或 AWS CodeBuild Docker 策划的项目设置 PrivilegedMode图片。”

9    [main] INFO  org.janusgraph.codepipelines.AwsCodePipelinesCi  -
{
    Name: j1pass-bdb-project,
    Source: {Type: CODEPIPELINE,},
    Artifacts: {Type: CODEPIPELINE, Name: null-artifacts,Packaging: NONE},
    Environment: {Type: LINUX_CONTAINER,
    Image: aws/codebuild/java:openjdk-8,
    ComputeType: BUILD_GENERAL1_LARGE,
    EnvironmentVariables: [{Name: MODULE,Value: janusgraph-berkeleyje}],
    PrivilegedMode: true},
    ServiceRole: arn:aws:iam::############:role/cbjanus,
    TimeoutInMinutes: 480
}
1454 [main] ERROR org.janusgraph.codepipelines.AwsCodePipelinesCi  -
PrivilegedMode can only be set for projects with custom or AWS CodeBuild Docker
curated images. (Service: AWSCodeBuild; Status Code: 400;
Error Code: InvalidInputException; Request ID: 89ab67a0-4d00-11e7-8da7-bdeb9326cb3c)
com.amazonaws.services.codebuild.model.InvalidInputException: PrivilegedMode can
only be set for projects with custom or AWS CodeBuild Docker curated images.
(Service: AWSCodeBuild; Status Code: 400;
Error Code: InvalidInputException; Request ID: 89ab67a0-4d00-11e7-8da7-bdeb9326cb3c)
4

1 回答 1

3

AWS CodeBuild “Docker” 精选镜像是以“aws/codebuild/docker”开头的镜像。可在此处找到 CodeBuild 精选图像的完整列表:http: //docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html

您只能为您的“自定义”图像设置这个最近引入的标志。这些是您可能在私有 Amazon ECR 注册表或公共 DockerHub 注册表中拥有的映像。有关如何在此处启用标志的示例:http: //docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-custom-image.html

因此,对于您的示例,您会收到此错误,因为虽然您使用的 openjdk-8 图像是一个精选图像,但它不是“docker”精选图像。

于 2017-06-09T13:44:45.207 回答