Vineeth
Vineeth

Reputation: 1032

Use ECS repository image as build image in CircleCI

I have been using my Docker-hub account till now in CircleCI, and now for some reason I'm trying to use my ECR repository image in the same place as build image in CircleCI (2.0)

But I see ECR doesn't support public images. So I can't mention my image as below as I did for Dockerhub image,

version: 2
jobs:
  build:
    working-directory: ~/tmp
    docker:
        - image: <dockerhub-name>/<image>

as,

version: 2
jobs:
  build:
    working-directory: ~/tmp
    docker:
        - image: aws-id.dkr.ecr.eu-central-1.amazonaws.com/image

It will throw error,

no basic auth credentials

In a straight forward operation it needs to get authenticated via command,

aws ecr get-login --region <region-name>

and then running,

docker login -u AWS -p <password> -e none https://aws-id.dkr.ecr.eu-central-1.amazonaws.com

I tried putting this commands in Pre-dependency commands section of CircleCI plan settings and didn't work.

Ideas?

Upvotes: 1

Views: 366

Answers (1)

FelicianoTech
FelicianoTech

Reputation: 4017

What "Pre-dependency commands"? That sounds like you're referring to configuration structure from CircleCI 1.0, which you don't seem to be using.

Because of the way AWS requires you to authenticate with ECR, I wouldn't use an image from there with the docker executor. Either use some random image, and then use setup_remote_docker or use the machine executor.

This doc shows the former, and this one covers the latter.

Upvotes: 1

Related Questions