Docker Community Forums

Share and learn in the Docker community.

Docker image in AWS Codebuild

AWS codebuild runs in a docker image. Within that image I am trying to do a DOCKER_BUILDKIT=1 docker image build --pull --rm cfn-nag -v 0.7.14. This was working until a couple of months ago. I am able to get into the codebuild container. From there, if I do — docker container run -it --privileged ruby:3.0-alpine sh — I get into the container and can run the gem install command. When doing the codebuild I get an

#7 1.289 ERROR:  While executing gem ... (Gem::FilePermissionError)
#7 1.289     You don't have write permissions for the /usr/local/bundle directory.

Problem is there is no --privileged flag for doing the docker build.

Can you provide some guidance on how to get this to work?

My Dockerfile

FROM ruby:3.0-alpine


RUN echo "installing cfn-nag version: ${GEM_VERSION}"
RUN gem install cfn-nag -v "${GEM_VERSION}"

VOLUME /var/lib/docker
CMD ["cfn_nag"]