Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I have Ubuntu 20.04 and I have tried using
docker login
to log in in terminal, but got:
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 https://hub.docker.com to create one.
Username: sfelshtyn
Password:
Error saving credentials: error storing credentials - err: exit status 1, out: `error getting credentials - err: exit status 1, out:` no usernames for https://index.docker.io/v1/``
–
–
–
I read Error saving credentials: error storing credentials - err: exit status 1, out: pass store is uninitialized to solve my problem, but none of them helped.
Then I switched to official docker documentation and found that I didn't go through the credentials management process during docker installation.
I did a few steps:
gpg --generate-key
pass init <generated gpg-id public key>
docker pull molly/privateimage
After that I tried again docker login. I passed my personal data and it worked for me. I solved my issue.
–
–
Remove the key credStore
from ~/.docker/config.json
, and everything works normal now.
Before:
"auths": {},
"credsStore": "desktop", // remove this line, irrespective of the value of credStore
"currentContext": "desktop-linux"
After:
"auths": {},
"currentContext": "desktop-linux"
Remove docker-credential-helpers
rm -rf ~/.password-store/docker-credential-helpers
Generate GPG Key Pair
gpg --generate-key
Initialize pass
utility, which is a password manager that uses GPG encryption for storing and managing passwords
pass init <generated gpg-id public key>
References:
https://github.com/docker/docker-credential-helpers/issues/24#issuecomment-595692091
https://github.com/docker/docker-credential-helpers/issues/60#issuecomment-336748027
service docker start
Basically, you need to remove your credentials from your local environment,(These two rm ~ commands do this work)
If you are having permission issues, use sudo
When you run the gpg command. Then while running the pass init command, pass the pub key generated on the the output of gpg command.
$ pass init <pub key from gpg command>
Just to add another solution taking from the other answers here.
If you've already started Docker Desktop and you're seeing the error:
error storing credentials - err: exit status 1, out: `error getting credentials - err: exit status 1
Stop the application:
systemctl --user stop docker-desktop
If you've already followed the steps in credentials-management-for-linux-users - make sure you provide the correct email. I used the wrong one which is why it wasn't working! Delete the existing pass key:
rm -rf ~/.password-store/docker-credential-helpers
Generate a new key and provide the correct credentials:
gpg --generate-key
This will print out text like:
pub rsa3072 2023-06-13 [SC] [expires: 2025-06-12]
sdfasdfsdfsdfdsfasdf
uid Your Name <Your Email>
sub rsa3072 2023-06-13 [E] [expires: 2025-06-12]
Then use the gpd-id
displayed next to pub
or sub
to initialise pass
, e.g.:
pass init rsa3072
Finally, start Docker Desktop:
systemctl --user start docker-desktop
Hope this helps!