Set Up Docker Credential Store on VMware Photon

If you’re using ESXi hypervisors and Docker, you’re probably using VIC or running it on an Ubuntu VM. But recently we tried VMware’s new “Minimal Linux Container Host”, Photon OS.

With Photon, you can install packages using tdnf. To keep it minimalist, we avoided adding any additional repositories, but this made it surprisingly difficult to set up the credential store. We decided to set up pass to protect our login. Otherwise, credentials will appear in cleartext in the ~/.docker/config.json file.

Install Packages from tdnf

To make this easier you’ll want all of the below packages.

  • wget
  • tar
  • make
  • gnupg
  • tree
root@photon-machine [ ~ ]# tdnf -y install wget tar make gnupg tree

Login to Docker

Log in to Docker at least once if you have not already done so. This will automatically create the ~/.docker/config.json file for you.

root@photon-machine [ ~ ]# docker login
Login with your Docker ID to push and pull images from 

Docker Hub

. If you don't have a Docker ID, head over to to create one.
Username: pandatech0
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See

Login Succeeded
root@photon-machine [ ~ ]# docker logout
Removing login credentials for

Manually Install pass

None of the built-in repositories in Photon come with pass. Be sure to check the official site in case there is a newer version than what is in the instructions below.

root@photon-machine [ ~ ]# wget
root@photon-machine [ ~ ]# tar -xf password-store-1.7.3.tar.xz 
root@photon-machine [ ~ ]# cd password-store-1.7.3/
root@photon-machine [ ~ ]# make install

Manually Install docker-credential-pass

Once pass is installed, you can download and install docker-credential-pass from Docker’s GitHub.

root@photon-machine [ ~ ]# wget
root@photon-machine [ ~ ]# tar -xf docker-credential-pass-v0.6.0-amd64.tar.gz
root@photon-machine [ ~ ]# chmod +x docker-credential-pass 
root@photon-machine [ ~ ]# mv docker-credential-pass /usr/local/bin/

Update the Docker Config File

root@photon-machine [ ~ ]# vi ~/.docker/config.json

This file should have been automatically created the first time you ran docker login. Add line 8 as seen below:

    "auths": {
        "": {}
    "HttpHeaders": {
        "User-Agent": "Docker-Client/18.06.2 (linux)"
    "credsStore": "pass"

Generate Keys for the Store

Before you can properly use pass, you’ll need to generate a key for encrypting all your passwords. For simplicity we used the simple command. You may want to consider using gpg --full-generate-key to view all of the possible key creation options.

root@photon-machine [ ~ ]# gpg --generate-key

You’ll be prompted for email address, and then you’ll be asked to create and confirm a password for the store. Below is the sample output. This may take a while to generate the key. I usually set it to run before bed.

gpg (GnuPG) 2.2.10; Copyright (C) 2018 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: 
Email address: [email protected]
You selected this USER-ID:
    "[email protected]"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

Initialize Pass

First, verify that a new, valid key was created with the below:

root@photon-machine [ ~ ]# gpg --list-keys
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2020-02-27
pub   rsa2048 2018-02-28 [SC] [expires: 2020-02-27]
uid           [ultimate] [email protected]
sub   rsa2048 2018-02-28 [E] [expires: 2020-02-27]

After verification, initialize pass using the email address you created a key with. You’ll be prompted to create and confirm a password for the store.

root@photon-machine [ ~ ]# pass init [email protected]
Password store initialized for [email protected]

Initialize docker-credential-pass

Using pass show you should see the docker-credential-helpers. If not, try running docker login and docker logout again. You may receive an error that “pass store is uninitialized”. Run the below to initialize the docker-credential-helpers. You may get a prompt for your store’s password again (the password you created in the previous step).

root@photon-machine [ ~ ]# pass show
Password Store
└── docker-credential-helpers
    └── docker-pass-initialized-check

root@photon-machine [ ~ ]# pass show docker-credential-helpers/docker-pass-initialized-check 
pass is initialized

root@photon-machine [ ~ ]# pass show
Password Store
└── docker-credential-helpers
    └── sHR0cHM6Ly0pdNRLeC5kb2NrZXIvyW8vdjFW
        └── pandatech0


You should be all set now. But now logging in will sometimes be a two-step process because the store will time out after some time:

root@photon-machine [ ~ ]# pass show docker-credential-helpers/docker-pass-initialized-check 
pass is initialized

root@photon-machine [ ~ ]# docker login
Authenticating with existing credentials...
Login Succeeded

After docker login, you can check cat ~/.docker/config.json, and you should not see any of your credentials in cleartext. Now you are finally ready to safely push and pull containers through your Docker Hub account.

Leave a Reply

Your email address will not be published. Required fields are marked *