title: AWS CodePipeline Fails on Build
body: <p>The CodeBuild portion of my pipeline keeps failing with the following error:</p>
  <pre><code>BUILD_CONTAINER_UNABLE_TO_PULL_IMAGE: Unable to pull customer's container image. CannotPullContainerError: Error response from daemon: pull access denied for 123456789.dkr.ecr.us-east-1.amazonaws.com/diag_test, repository does not exist or may require 'docker login': denied: User: CodeBuild
  </code></pre>
  <p>I did some beginning research and saw that maybe the IAM role it was using didn't have enough permissions so I attached the AmazonEC2ContainerRegistryFullAccess policy to the role and attempted again - same results.</p>
  <p>I verified the URI is correct.</p>
  <p>What am I missing?</p>
  <p>buildspec.yaml below:</p>
  <pre><code>version: 0.2
  
  phases:
    pre_build:
      commands:
        - echo Logging in to Amazon ECR...
        - aws --version
        - aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 12345678.dkr.ecr.us-east-1.amazonaws.com
        - REPOSITORY_URI=12345678.dkr.ecr.us-east-1.amazonaws.com/diag_test
        - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
        - IMAGE_TAG=${COMMIT_HASH:=latest}
    build:
      commands:
        - echo Build started on `date`
        - echo Building the Docker image...
        - docker build -t $REPOSITORY_URI:latest .
        - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
    post_build:
      commands:
        - echo Build completed on `date`
        - echo Pushing the Docker images...
        - docker push $REPOSITORY_URI:latest
        - docker push $REPOSITORY_URI:$IMAGE_TAG
        - echo Writing image definitions file...
        - printf '[{&quot;name&quot;:&quot;diag_test&quot;,&quot;imageUri&quot;:&quot;%s&quot;}]' $REPOSITORY_URI:$IMAGE_TAG &gt; imagedefinitions.json
  artifacts:
      files: imagedefinitions.json
  </code></pre>
  <p>Thanks in advance for the assist! :)</p>