Use AWS CDK to create CodeBuild Project for building Docker Images


I want to define a CodeBuild project in source code using the AWS CDK. The CodeBuild project needs to be able to build and then push docker images.

When creating a new CodeBuild Project in the AWS Console there’s an option:

Privileged Enable this flag if you want to build Docker images or want your builds to get elevated privileges.

enter image description here

I don’t see an equivalent api for turning on the Privileged flag in the API Docs.

And if I try to run my build without setting Privileged to true, I’ll get the standard error:

How to I use the AWS CDK to create a CodeBuild Project that has “Privileged” to build Docker images?


In general, you can find all other (build) environment settings here:

Leave a Reply