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',).

CorayThan
  • 131
  • 1
  • 1
  • 6
  • 1
    Why not just move the binary to /usr/local/bin ? And did you update the ~/.docker/config.json like the repo says? – strongjz Feb 19 '18 at 14:15
  • @strongjz Yeah, I did update the docker config like the docs suggest. Tried moving the binary to `/usr/local/bin` and restarting, but that didn't make it any better. Appreciate the advice, but I think I'll just side-step the issue and do it manually or do it with Ansible a different way! – CorayThan Feb 19 '18 at 19:27
  • Received this error when upgrading to Mac OS High Sierra. It seems to have deleted my ECR credentials helper from `/usr/bin` but kept the reference to it in `$HOME/.docker/config.json` I just removed the reference to "ecr-login" in my `config.json` and everything works again! – Phil Feb 27 '18 at 14:54

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