- I have an image in an Amazon ECR Repository called workshop
- I have a Dockerfile to pull that image
- CodeBuild should build the new image from Dockerfile
Problem:
pull access denied for xxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com/workshop, repository does not exist or may require 'docker login'
In my buildspec file, I've tried to login with docker, but nothing changes.
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION)
- aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin
xxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com
- CODEBUILD_RESOLVED_SOURCE_VERSION="${CODEBUILD_RESOLVED_SOURCE_VERSION:-$IMAGE_TAG}"
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
Dockerfile looks like this:
FROM xxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com/workshop:latest
CMD ["echo", "Hallo!"]
RUN code-server
What may cause the Problem?
Allow: ecr:*, so I can pull the images from ECR but it didn't work. @Marcin - vasil001ecr:*for Principal AWS account id and then 2) adding service role to CodeBuild to allowecr:*forresources: *and 3) addedaws ecr get-login-password --region region | docker login -u AWS --password-stdin xxx.dkr.ecr.eu-west-2.amazonaws.com/image:tagto theinstallphase of mybuildspec.ymlfile - Krizza