Docker credential store-ECR
WARNING! Your password will be stored unencrypted in /home/ashwini-gaddagi/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Found of this error ? :p
Here is what I did to get my docker client working with docker-credentials-pass !
- Get the pass ( for Linux)
wget https://github.com/docker/docker-credential-helpers/releases/download/v0.6.3/docker-credential-pass-v0.6.3-amd64.tar.gz
- Extract it
- change the permission
- Make it accessible ($PATH)
tar -xvzf docker-credential-pass-v0.6.3-amd64.tar.gz && chmod +x docker-credential-pass && sudo mv docker-credential-pass /usr/local/bin/
- Check if its working :
docker-credential-pass
=>Usage: docker-credential-pass <store|get|erase|list|version>
- sudo apt-get install pass
- Create a new gpg2 key and follow the Prompts and remember what you did.
gpg2 --gen-key
- Initialize pass using the newly created key
pass init "<Your Name>"
- Add credsStore to your docker config.
sed -i '0,/{/s/{/{\n\t"credsStore": "pass",/' ~/.docker/config.json
- Make sure you are logged out from the accounts.
- Login into the accountBy default it trys to login to dockerhub account because thats what the endpoint it has. To login to ECR get the token first and then login by pointing to the ECR endpoint .get the credentials !
aws ecr get-login --no-include-email --region <region> --profile <your_profile> > ecr_login_pass.txt
Note: It copies everything need to use sed command to copy just the password into the text file. The file should contain only password provided.login !cat ecr_login_pass.txt | docker login --username AWS --password-stdin <your_aws_ECR_account_url>
- Logout
docker logout <your_aws_ECR_account_url>