简体   繁体   中英

Creating a CodeBuild project using an AWS curated Docker image with PrivilegedMode=TRUE

I confirmed that aws/codebuild/java:openjdk-8 is one of the curated CodeBuild images with the following command.

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

Despite aws/codebuild/java:openjdk-8 being a curated image, when I try to create a build project using that image and the PrivilegedMode=true parameter, I get a 4XX error that does not make sense: "PrivilegedMode can only be set for projects with custom or AWS CodeBuild Docker curated images."

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)

The AWS CodeBuild "Docker" curated images are the ones that start with "aws/codebuild/docker". Complete list of CodeBuild's curated images can be found here: http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html .

You can only set this flag, which was recently introduced, for your "custom" image. These are images that you may have in your private Amazon ECR registry or public DockerHub registry. Sample on how to enable the flag here: http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-custom-image.html .

So, for your sample you are getting this error because although openjdk-8 image that you used was a curated image, it wasn't the "docker" curated image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM