Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

docker login fails with 'error storing credentials' on Linux

ErrorError saving credentials: error storing credentials

Short answer

Docker hands your password to a credential helper named in ~/.docker/config.json. The error means that helper is missing, not on PATH, or not set up (pass has no GPG key). Look at config.json first, then install the helper, initialise pass, or remove the stale credsStore line.

  • Applies to Docker Engine 27, Docker CLI 27, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the Docker client config. The credsStore or credHelpers entry names the helper that is failing.

    cat ~/.docker/config.json
    which docker-credential-desktop docker-credential-pass docker-credential-secretservice
  2. 2Match what you see, then jump to its fix

    1. 1config.json has a credsStore value, and which prints nothing for docker-credential-<value>The helper named in config.json is not installed or not on PATHFix
    2. 2credsStore is pass and docker-credential-pass exists, yet login still failsThe helper is pass, but pass has no GPG key behind itFix
    3. 3You do not want a keychain on a server or CI boxThe login is stored in plain text by choiceFix

What does the error look like?

  • Error saving credentials: error storing credentials
  • error getting credentials - err: exit status 1

Cause 1 of 3

The helper named in config.json is not installed or not on PATH

1Check

The value of credsStore is the part after docker-credential-. Docker looks for that binary on PATH. If the named binary is not installed, the login cannot be stored.

grep -E 'credsStore|credHelpers' ~/.docker/config.json
command -v docker-credential-desktop

2Fix

Install the helper you want from the docker-credential-helpers releases, or delete the credsStore line so Docker stores the login in config.json. Run docker logout first so nothing stays in the old place.

docker logout
# edit ~/.docker/config.json and remove the "credsStore" line
docker login

3Verify

docker login prints Login Succeeded.

docker login

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 3

The helper is pass, but pass has no GPG key behind it

1Check

The pass helper stores secrets in a GPG-encrypted password store. The store must be initialised with a key ID from the gpg2 keyring.

gpg --list-keys
ls ~/.password-store

2Fix

Create a key, take the ID from the pub line, and initialise pass with it.

gpg --generate-key
pass init <your-gpg-id>

3Verify

Log in again. You may be asked for the passphrase you set for the key.

docker login

Confirmed by docs.docker.com

Did this fix it?

Cause 3 of 3

The login is stored in plain text by choice

1Check

With no credsStore and no credHelpers, Docker writes the login into config.json as base64 text. That is less safe than a store, but it is what Docker does when none is set.

grep -A3 '"auths"' ~/.docker/config.json

2Fix

Remove credsStore, log in once, and keep the file readable only by the user. For CI, use a short-lived or scoped access token instead of a password.

chmod 600 ~/.docker/config.json
docker login

3Verify

The registry host appears under auths and pulls from private repositories work.

docker pull <your-private-image>

Confirmed by docs.docker.com

Did this fix it?

How do I stop it coming back?

  • Do not copy ~/.docker/config.json between machines; it carries the helper name with it.
  • Run docker logout before you change credsStore, so no credential is left in the old store.
  • On servers, use an access token with the least scope the job needs.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Servers

A dev container port does not open in the browser when Docker runs on a remote host

If your application only accepts calls from localhost, it will reject connections from published ports

Three things usually break it: the app listens only on localhost inside the container, so published ports are rejected; you open the container port instead of the mapped localhost port VS Code shows; or you changed appPort or a Compose ports list and did not rebuild.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.