Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to provide my AWS credentials in the docker.withRegistry call in jenkins pipeline?

In my Jenkinsfile, I am trying to push the image that I have built using the docker plugin like follows:

docker.withRegistry('https://<my-id>.dkr.ecr.us-east-1.amazonaws.com/', 'ecr:us-east-1:awscreds') {
  docker.image('image').push('latest')
}

The pipeline fails every time with the message ERROR: Could not find credentials matching ecr:us-east-1:awscreds but I do have my AWS key ID and secret key in my Jenkins credentials with the ID "awscreds".
What could be a potential fix for this?

Alternatively, can I provide my credentials directly instead of mentioning the credential ID in the call?

like image 766
sudhanva Avatar asked Dec 22 '17 06:12

sudhanva


1 Answers

I had the same error message. Make sure the Amazon ECR plugin is installed and up to date and that you reboot jenkins after the installation.

like image 158
quasar Avatar answered Oct 28 '22 10:10

quasar