Docker Credential-PASS setup in CLI
Generally when we are using CLI version of docker preferably in Linux (I use Arch BTW 👿) we have to enter pass key every time we are logging. To avoid that docker has provided a better way to save the credentials using credential-managers such as pass etc…,
Thanks to this Issue #102 we can now able to use pass (I prefer this since I am using it 😅) manager to save credentials and tell docker to login automatically using those.
Here is how we can set up:
- Install pass - Pass: The Standard Unix Password Manager
sudo pacman -S pass
- Download, extract, make executable, and move docker-credential-pass
wget https://github.com/docker/docker-credential-helpers/releases/download/v0.6.0/docker-credential-pass-v0.6.0-amd64.tar.gz && tar -xf docker-credential-pass-v0.6.0-amd64.tar.gz && chmod +x docker-credential-pass && sudo mv docker-credential-pass /usr/local/bin/
- Create a new gpg2 key if you didn’t initialize pass yet!!
gpg2 --gen-key # Follow prompts from gpg2 utility
- Initialize pass using the newly created key
pass init "<Your Name/Key>"
- Add credsStore to your docker config. This can be done with
sed
if you don’t already have credStore added to your config, or you can manually add “credStore”:“pass” to the config.json.
sed -i '0,/{/s/{/{\n\t"credsStore": "pass",/' ~/.docker/config.json
- Login to docker
docker login