nerdexam
Amazon

DOP-C02 · Question #146

A company builds a container image in an AWS CodeBuild project by running Docker commands. After the container image is built, the CodeBuild project uploads the container image to an Amazon S3 bucket.

Sign in or unlock DOP-C02 to reveal the answer and full explanation for question #146. The question stem and answer options stay visible for context.

Submitted by fatima_kr· Mar 6, 2026SDLC Automation

Question

A company builds a container image in an AWS CodeBuild project by running Docker commands. After the container image is built, the CodeBuild project uploads the container image to an Amazon S3 bucket. The CodeBuild project has an IAM service role that has permissions to access the S3 bucket. A DevOps engineer needs to replace the S3 bucket with an Amazon Elastic Container Registry (Amazon ECR) repository to store the container images. The DevOps engineer creates an ECR private image repository in the same AWS Region of the CodeBuild project. The DevOps engineer adjusts the IAM service role with the permissions that are necessary to work with the new ECR repository. The DevOps engineer also places new repository information into the docker build command and the docker push command that are used in the buildspec.yml file. When the CodeBuild project runs a build job, the job fails when the job tries to access the ECR repository. Which solution will resolve the issue of failed access to the ECR repository?

Options

  • AUpdate the buildspec.yml file to log in to the ECR repository by using the aws ecr get-login-password
  • BAdd an environment variable of type SECRETS_MANAGER to the CodeBuild project. In the
  • CUpdate the ECR repository to be a public image repository. Add an ECR repository policy that allows
  • DUpdate the buildspec.yml file to use the AWS CLI to assume the IAM service role for ECR operations.

Unlock DOP-C02 to see the answer

You've previewed enough free DOP-C02 questions. Unlock DOP-C02 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#AWS CodeBuild#Amazon ECR#Container Images#buildspec.yml
Full DOP-C02 Practice