jenkins-pipelineaws-ecr

Jenkins pipeline Docker agent from AWS ECR


I need to execute Jenkins pipeline in Docker as an agent,

Docker image is located in AWS ECR,

How can I auth over AWS ECR to pull image for agent?


Solution

  • According to this page https://aws.amazon.com/blogs/compute/authenticating-amazon-ecr-repositories-for-docker-cli-with-credential-helper/ something like the following should work:

    sh """#!/bin/bash
          docker login -u=${USER} -p=${PASS} https://aws_account_id.dkr.ecr.us-east-1.amazonaws.com
    """