How to add amazon-ecr-credential-helper to path

10,256

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)

Share:
10,256

Related videos on Youtube

CorayThan
Author by

CorayThan

Professional software developer and gamer. Check out my collectible card game website for KeyForge! https://decksofkeyforge.com/

Updated on September 18, 2022

Comments

  • CorayThan
    CorayThan over 1 year

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

    • strongjz
      strongjz about 6 years
      Why not just move the binary to /usr/local/bin ? And did you update the ~/.docker/config.json like the repo says?
    • CorayThan
      CorayThan about 6 years
      @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!
    • Phil
      Phil about 6 years
      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!
  • JoanComasFdz
    JoanComasFdz about 5 years
    Any idea on how to do this on Windows 10?
  • Jacques Koorts
    Jacques Koorts over 4 years
    For mint 5. sudo cp ./bin/local/docker-credential-ecr-login /usr/bin/docker-credential-ecr-login. Also 6 refers to your home dir
  • Fumisky Wells
    Fumisky Wells over 4 years
    For Ubuntu, the destination path for cp would be /usr/bin/ or /usr/local/bin rather than /usr/bin/lib, right?