Answers: <p>The docker login failed.</p>
  
  <p>Error response from daemon: Get <a href="https://https/v2/" rel="nofollow noreferrer">https://https/v2/</a>: dial tcp: lookup https: Temporary failure in name resolution</p>
  
  <p>The url is invalid.</p>
  
  <p>change from </p>
  
  <p><code>docker login -u AWS -p ******** https:/123456790.dkr.ecr.us-east-1.amazonaws.com</code></p>
  
  <p>to</p>
  
  <p><code>docker login -u AWS -p ******** 123456790.dkr.ecr.us-east-1.amazonaws.com</code></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-17T19:52:13.507Z
Answers: 2019-11-17T19:52:13.507Z
Answers: user48545
Answers: <p>Please see the below lines from the AWS ECR docs. (<a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html</a>)</p>
  
  <p><code>
  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.
  </code></p>
  
  <p>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.</p>
  
  <p>You can see various methods <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/registries.html#registry_auth" rel="nofollow noreferrer">here</a> 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.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-17T18:43:42.150Z
Answers: 2019-11-17T18:43:42.150Z
Answers: Samit
Body: <p>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.</p>
  
  <p>I am using correct credentials that are valid for the region I am trying to push to. </p>
  
  <p>However I am getting this error message</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Jenkins pipeline script</p>
  
  <pre><code>docker.withRegistry('https:/1234567890.dkr.ecr.us-east-1.amazonaws.com', 'ecr:us-east-1:aws-type-creds') {
      app.push(env.GIT_COMMIT)
   }
  </code></pre>
  
  <p>EDIT **
  Now getting this error with small change to pipeline</p>
  
  <pre><code>+ 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
  </code></pre>
  
  <p>Line changed was line 2 of the pipeline code I showed before. It is now <code>docker.image('alerts').push(env.GIT_COMMIT)</code></p>
  
Tags: <docker><jenkins><jenkins-pipeline><docker-registry>
Title: Issue pushing to ECR using Jenkins
UserDisplayName: joshk132
ThreadText: # Issue pushing to ECR using Jenkins
  
  (Asked by: username_0 on 2019-11-14)
  
  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') {
      app.push(env.GIT_COMMIT)
   }
  
  ```
  
  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)`
  
  **Tags:** docker, jenkins, jenkins-pipeline, docker-registry
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-11-17. Score: 1
  
  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`
  
  to
  
  `docker login -u AWS -p ******** 123456790.dkr.ecr.us-east-1.amazonaws.com`
  
  
  ---
  
  ### Answer by username_2 on 2019-11-17. Score: 0
  
  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](https://docs.aws.amazon.com/AmazonECR/latest/userguide/registries.html#registry_auth) 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.
  
  
  ---
  
  