3

I'm trying to set up amazon-ecr-credential-helper so that I can have an ansible script automatically push / pull to my aws ecr docker repository, but the instructions for installing it seem very vague.

Since I already have Docker installed I tried cloning the repo and running make docker. It says that outputs the binary "to local directory." Which appeared to be true, I ended up with ./bin/local/docker-credential-ecr-login being built. So I tried adding that to my path:

.bash_profile export PATH="$HOME/anaconda3/bin:$HOME/projects/amazon-ecr-credential-helper/bin:$PATH"

And restarting my terminal, but when I try to do a docker push I get the error no basic auth credentials.

And if I try to do a docker-compose build I get the error Credentials store error: StoreError('docker-credential-ecr-login not installed or not available in PATH',).

Nelaina
  • 130

1 Answers1

3

Steps to set up Credential helper on Ubuntu.

This assumes, you have docker installed and AWS credentials available at: ~/.aws/credentials file

  1. Clone the git repository https://github.com/awslabs/amazon-ecr-credential-helper.git
  2. cd to the cloned folder "amazon-ecr-credential-helper"
  3. run the command on terminal "make docker"
  4. it will create the binary "./bin/local/docker-credential-ecr-login"
  5. Copy this binary to /usr/bin/lib with the command " sudo cp ./bin/local/docker-credential-ecr-login /usr/bin/lib/docker-credential-ecr-login
  6. Create or modify the docker config.json file available at /.docker/config.json with the below content

      {
          "credsStore": "ecr-login"
       }
    

    then try pushing the docker image to AWS ECR repository

Ravneet Arora(DevOps)

Ravneet
  • 31
  • 2