How to setup docker credential-store

published on Tue, 28 Jul 2020


#Development  #Devops  #Docker 

Since docker version 19 it start notifying the user that the docker credentials are stored unencrypted.

WARNING! Your password will be stored unencrypted …

To solve this we will use the Docker credential-store feature.

In this blog post we are going to use install the latest docker-credential-pass helper in combination with pass as a store and gpg for key generation.

sudo apt-get install -y pass gpg
gpg2 --gen-key
# copy gpg-key
pass init "<gpg-pub-key>"

sed -i '0,/{/s/{/{\n\t"credsStore": "pass",/' ~/.docker/config.json

The following one-line will download the latest docker-credential-pass helper from github and extract it to the ~/bin directory:

curl -fsSLI -o /dev/null -w %{url_effective} https://api.github.com/repos/docker/docker-credential-helpers/releases/latest | xargs curl -s | grep -o "https.*docker-credential-pass.*tar.gz" | wget -qi - && mkdir -p ~/bin && tar -xvf docker-credential-pass-v*-amd64.tar.gz -C ~/bin

Finally, login with your docker credentials.

docker login