Search code examples
amazon-web-servicesdockerjenkinsjenkins-pipelineamazon-ecr

Error response from daemon: no such id in Jenkinsfile for uploading docker image to ECR


I'm adding script in Jenkinsfile and trying to push docker image to ECR The build was successful, but I got this error:

Successfully built xxxxxx
Error response from daemon: no such id: aaaaaa-tests:latest

I tried to modify the docker push "${ecrHost}/${ecrRepo}" by getting rid of "latest" but got the same error.

I'm not sure which step goes wrong, docker tag or docker push, very new to all of these stuff, can someone explain what's going on? Already messing around for a whole day now. Many thanks.


Solution

  • Based on the all discussions the straight way is:
    Step 1: create one IAM role
    Step 2: attach the AWS managed policy which should be name of AmazonEC2ContainerRegistryFullAccesswith the IAM role
    Step 3: attach the IAM role with the Jenkins instance

    Now run the Jenkins job it should be able to succeed.