I'm trying to push an image to ECR via a Jenkins pipeline. Currently I have the ECR plugin installed, and a role assigned to my EC2 instance that allows ECR access.

I am using correct credentials that are valid for the region I am trying to push to.

However I am getting this error message

Pipeline] withDockerRegistry
Using the existing docker config file.Removing blacklisted property: credsStore$ docker login -u AWS -p ******** https:/123456790.dkr.ecr.us-east-1.amazonaws.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://https/v2/: dial tcp: lookup https: Temporary failure in name resolution

Jenkins pipeline script

docker.withRegistry('https:/1234567890.dkr.ecr.us-east-1.amazonaws.com', 'ecr:us-east-1:aws-type-creds') {

EDIT ** Now getting this error with small change to pipeline

+ docker push 1234567890.dkr.ecr.us-east-1.amazonaws.com/sample:66e4bf8547da1b2fd8f852e093fd152a6b1ee598
The push refers to repository [1234567890.dkr.ecr.us-east-1.amazonaws.com/sample]
1f15c22274e7: Preparing
70da67205593: Preparing
f0726b634cb9: Preparing
ab91817addbe: Preparing
1be049a99262: Preparing
cc82fb177433: Preparing
97a48aebb8e5: Preparing
1f7e5026a4f7: Preparing
9e864b659f2b: Preparing
f1b5933fe4b5: Preparing
cc82fb177433: Waiting
97a48aebb8e5: Waiting
1f7e5026a4f7: Waiting
9e864b659f2b: Waiting
f1b5933fe4b5: Waiting
no basic auth credentials

Line changed was line 2 of the pipeline code I showed before. It is now docker.image('alerts').push(env.GIT_COMMIT)


The docker login failed.

Error response from daemon: Get https://https/v2/: dial tcp: lookup https: Temporary failure in name resolution

The url is invalid.

change from

docker login -u AWS -p ******** https:/123456790.dkr.ecr.us-east-1.amazonaws.com


docker login -u AWS -p ******** 123456790.dkr.ecr.us-east-1.amazonaws.com


Please see the below lines from the AWS ECR docs. (https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html)

Authenticate your Docker client to the Amazon ECR registry to which you intend to push your image. Authentication tokens must be obtained for each registry used, and the tokens are valid for 12 hours.

Since you have already an IAM role to EC2 instance which will allow ECR access, you need to first get the authentication details (username and password) and login to ECR.

You can see various methods here to find out how you can get the authentication details and use them to login to ECR first. Once you are logged in, the you can seamlessly push images to ECR repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.