How to fix pass store is uninitialized on Ubuntu Linux in Docker setup


The error message you’re seeing, “pass store is uninitialized“, indicates that the `pass` utility, which Docker uses for secure password storage, hasn’t been set up yet. To initialize `pass` and resolve this error, follow these steps:

  1. **Install Pass**: If you haven’t already, ensure that the `pass` password manager is installed on your system. You can do this on a Debian-based system (like Ubuntu) using:
       sudo apt-get update
       sudo apt-get install pass
  2. Initialize the Password Store: The password store needs to be initialized with a GPG key. If you don’t have a GPG key yet, you’ll need to create one:
    • Generate a GPG Key (if needed):
           gpg --full-generate-key

      Follow the prompts to create your key. You’ll be asked to provide a name, email, and a passphrase. Remember or securely store the passphrase, as it’s needed to unlock the key.

    • List GPG Keys:
      After creating a GPG key, list your available GPG keys to find the ID of the key you want to use with `pass`:

           gpg --list-secret-keys --keyid-format LONG

      Look for a line that looks like `sec rsa4096/KEY_ID_HERE 202X-XX-XX [SC]`. The `KEY_ID_HERE` part is your key ID.

    • Initialize Pass:
      With your GPG key ID, initialize the `pass` store:

           pass init "KEY_ID_HERE"
  3. Verify Initialization: To verify that `pass` has been initialized and is working, try adding a test entry:
       pass insert docker-credential-helpers/test

    When prompted, enter a test password. You can then list the contents of your password store:

  4. Configure Docker to Use `pass`: Ensure Docker is configured to use `pass` by checking your `~/.docker/config.json` file. It should have a line that specifies `pass` as the credsStore or credential helper:

    "credsStore": "pass"

By following these steps, you should be able to initialize `pass` for Docker credential storage and resolve the “pass store is uninitialized” error. If you encounter any issues along the way, the error messages provided by each command can often give clues on how to proceed.