3

What I'd like to do is use an ECR image as an agent in Jenkins when using declarative pipeline

Current top of pipeline script looks like so:

pipeline {
    agent {
        docker {
            image '01111111111.dkr.ecr.eu-west-1.amazonaws.com/some-repo/some-image'
        }
    }

And the error I get is:

Error response from daemon: pull access denied for 01111111111.dkr.ecr.eu-west-1.amazonaws.com/some-repo/some-image, repository does not exist or may require 'docker login'

Which makes sense, ECR requires a login, but you can't just do a standard username and password as it's a token system so it'll change over time.

The worker EC2 instance has a role with the rights to pull from ECR and pulling from ECR works fine in a step, it's just in the agent directive.

So does anyone have a way round this or a plugin that might allow me to use this image as an agent.

One work-round is to pull the container or build it in a different job but that doesn't help if there are updates and it's very much a work-round rather than a solution

  • 1
    Can't believe there is no easy solution to such a basic thing. – Adrian Faciu Jul 23 '19 at 12:57
  • You can use the `registryUrl` and `registryCredentialsId` parameters to the `docker` closure if you've configured Jenkins with appropriate AWS credentials. – skeggse Sep 12 '19 at 21:51

0 Answers0