docker login fails when storing credentials
error storing credentialsShort answer
docker login hands your password to a credential helper named in ~/.docker/config.json. If that helper is not installed, not on PATH, not initialised, or not the one the setting names, the store step fails. Check credsStore and credHelpers, install or correct the helper, or remove the setting.
Fix it fast
1Find out which cause you have
Read the client config. The credsStore or credHelpers value is the name of the program Docker runs, with docker-credential- put in front.
cat ~/.docker/config.json which docker-credential-desktop docker-credential-pass docker-credential-secretservice2Match what you see, then jump to its fix
What does the error look like?
error storing credentialsexecutable file not found in $PATH
Cause 1 of 2
The named credential helper is not installed or not on PATH
1Check
Take the value of credsStore (for example desktop, osxkeychain or pass), add the docker-credential- prefix, and see whether that program exists. A config copied from a machine with Docker Desktop often names a helper the new machine lacks.
grep -E 'credsStore|credHelpers' ~/.docker/config.json
command -v docker-credential-desktop || echo "helper missing"2Fix
Install the helper from the docker-credential-helpers releases and put the binary on PATH, or change credsStore to a helper that is installed. Without any helper, Docker falls back to base64 text in config.json, which is less secure.
# edit ~/.docker/config.json so the name matches an installed helper
{ "credsStore": "secretservice" }3Verify
Log in again.
docker loginConfirmed by docs.docker.com
Cause 2 of 2
The pass helper is installed but not initialised
1Check
The pass helper needs a gpg2 key ID and that key must exist in the gpg2 keyring. A fresh server has neither, so storing fails even though the program is found.
gpg2 --list-keys
pass ls2Fix
Create or import a gpg2 key and initialise pass with its ID, then log in again. If you do not want a key store on this machine, remove credsStore from config.json and log out first so no old entry is left.
# initialise pass with the key ID shown by gpg2 --list-keys,
# or remove credsStore from ~/.docker/config.json
gpg2 --list-keys3Verify
docker login stores the credentials without an error.
docker loginConfirmed by github.com
How do I stop it coming back?
- Do not copy ~/.docker/config.json between machines; let each machine create its own.
- On a headless server, use a helper that works without a desktop session (pass with a gpg key) and keep that key backed up.
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
docker login prints a warning about --password and how to log in without it
conflicting options: cannot specify both --password and --password-stdin
Docker prints this warning whenever you give docker login a real value with --password or -p, because the secret then sits in shell history and process lists.
4 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
sam local fails: Running AWS SAM projects locally requires Docker
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
sam local start-api and sam local invoke run your function inside a Docker container, so SAM stops if it cannot talk to Docker.
3 causes, each with a fixServers
dnf fails to download repo metadata in a CentOS 8 Docker build
The same Dockerfile built fine before 2022
CentOS Linux 8 reached end of life on 31 December 2021 and its content left the mirrors.
2 causes, each with a fixServers
pip install confluent-kafka fails because librdkafka/rdkafka.h is missing
pip stops while building confluent-kafka from source
The error means pip is compiling confluent-kafka from source, and the compiler cannot find the librdkafka C headers.
3 causes, each with a fixServers
Cypress says the npm package is installed but the binary is missing
Cypress binary is missing after npm install in CI or in a Docker build
The npm package is only a launcher.
3 causes, each with a fix