Install AWS ECR Credential Helper on Centos

Prerequisites
Install go and make to centos

1- yum install -y go make

If you are going to manage docker with another application like GitLab runner you have to apply 6,7,8th steps in gitlab-runner user

usermod -aG docker gitlab-runner
service docker restart

Installation

2- export GOPATH=$HOME/go

3- export PATH=$PATH:$GOPATH/bin

4- go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login

5- cp /root/go/bin/docker-credential-ecr-login /usr/local/bin/

Configurations

Create folder for aws credentials if you already installed aws cli tools and setup before you can skip this step
6- mkdir ~/.aws/

Add these lines to `~/.aws/credentials`

7-
[default]
aws_access_key_id = ACCESS_KEY_ID
aws_secret_access_key = SECRET_ACCESS_KEY

Add these lines to `~/.docker/config.json`

8-
{
"credHelpers": {
"aws_account_id.dkr.ecr.region.amazonaws.com": "ecr-login"
}
}

TEST

docker pull 123456789012.dkr.ecr.us-west-2.amazonaws.com/my-repository:my-tag

5 1 vote
Article Rating
Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Батрадин мандаринов
Батрадин мандаринов
3 years ago

Супер

1
0
Would love your thoughts, please comment.x
()
x