Karna

From Research to Reflection


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:

  1. Install pass - Pass: The Standard Unix Password Manager
sudo pacman -S pass
  1. 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/
  1. Create a new gpg2 key if you didn’t initialize pass yet!!
gpg2 --gen-key # Follow prompts from gpg2 utility
  1. Initialize pass using the newly created key
pass init "<Your Name/Key>"
  1. 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
  1. Login to docker
docker login