13
votes

I've followed the instructions on the Amazon ECR Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Amazon+ECR, which simply instructs a user to install the Amazon ECR configure the Docker Build & Deploy plugin), but Jenkins is unable to authenticate with ECR.

The error message produced is:

denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one.

Any advice anyone can provide is greatly appreciated.

2
I have the same issue - did you find a solution?macbutch

2 Answers

2
votes

I always use this command as the first step in my Jenkins jobs for login to ECR:

aws ecr get-login --no-include-email --profile ecr | bash

where "--profile ecr" is predefined profile in Jenkins (.asw/config, .aws/credentials)

0
votes

If you set the variable env.AWS_ECR_LOGIN=true in your pipeline, the issue is resolved. It is something on the docker.withregistry step: https://issues.jenkins-ci.org/browse/JENKINS-44143