Error saving credentials: error storing credentials - err: exit status 1, out: `error getting credentials - err: exit status 1
Asked Answered
G

17

82

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/``
Guarino answered 6/4, 2022 at 16:48 Comment(5)
Solution: I did a few steps: (You can find here: docs.docker.com/desktop/linux) gpg --generate-key ...Guarino
This ended up fixing it for me. I did have to first do rm -rf ~/.password-store/docker-credential-helpers to reset things and get it to work.Flaunt
@StanislavFelshtyn I suggest that you put this as an answer.Litch
Execute gpg --generate-key and then pass init "<user-id>" and then docker login should work. This at least works for me on Ubuntu 22.04.Lomax
I installed docker using the desktop app installation, after removing it and installing via apt everything worked.Astridastride
L
113

Try to execute following command

service docker stop
rm ~/.docker/config.json
service docker start

then try docker login it will ask for username and password

for macos m2 following works

sudo chown -R $(id -u):$(id -g) $HOME/.docker
Lethalethal answered 30/11, 2022 at 8:8 Comment(5)
Related comment in a GH issue for referenceShippy
The m2 solution as well as the ubuntu solution worked for me. I do not know why this isn't the answer??Varistor
Unless you add the credsStore field back into your .docker/config.json after doing this, it's just storing the unencrypted base64 encoded password in your .docker/config.json file.Salify
my problem was exactly this, and more specifically: the "auths" node in the config.json file was empty - which is exactly what the CLI is complaining about. Executing those three commands now adds the auth info in that node. Note that the password is shown with no hash, there, so be mindful of that.Assertive
another thing that I did was to remove the "credsStore" node from that config.json, so that my OS (fedora, linux) could use pass as the default credential store as the official documentation suggestsAssertive
G
50

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:

  1. gpg --generate-key
  2. pass init <generated gpg-id public key>
  3. 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.

Guarino answered 31/8, 2022 at 15:50 Comment(2)
Thanks! Definitely the answer that fixed my issue in the most proper way. This wasn't necessary on macos but is on linuxBarrator
Thanks, solves the issue for me on Ubuntu 22.04Lole
P
29

This worked for me -

pass remove -rf docker-credential-helpers
Palpitate answered 10/11, 2022 at 15:7 Comment(0)
R
27
  1. 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"
     }
    
  2. Remove docker-credential-helpers

    rm -rf ~/.password-store/docker-credential-helpers
    
  3. Generate GPG Key Pair

    gpg --generate-key
    
  4. 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:

  1. https://github.com/docker/docker-credential-helpers/issues/24#issuecomment-595692091
  2. https://github.com/docker/docker-credential-helpers/issues/60#issuecomment-336748027
Rudich answered 16/6, 2023 at 23:19 Comment(5)
Works like a charm. Followed step 1,3 and 4.Profundity
Same here, works like a charm. ThanksBascule
I'm on windows and "credStore" was "desktop". I removed that and it helped a little but I still got the same error in the output of my remote commandsUnderbody
Update. I used this solution github.com/docker/cli/issues/4353#issuecomment-1801655306Underbody
Removing the line fixed it in WSL. .password-store didn't exist so didn't have to do anything else.Goatsucker
P
11

The following helped me:

  1. rm -rf ~/.password-store/docker-credential-helpers
  2. gpg --generate-key
  3. pass init <generated gpg-id public key>
Prolate answered 2/1, 2023 at 21:7 Comment(1)
I passed in the wrong id :-( into "pass init [id]" and it gave me the error. This solved my problem!Esplanade
W
8

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 , delete the existing pass key:

rm -rf ~/.password-store/docker-credential-helpers

Generate a new key and provide the correct credentials:

gpg --generate-key

Note: make sure you set the correct email in the passkey you use to login into DockerHub. I used the wrong one, which was why Docker Desktop threw the error.

This will print out text like:

pub   rsa3072 2023-06-13 [SC] [expires: 2025-06-12]
      9F53995439D023FD
uid                      Your Name <Your Email>
sub   rsa3072 2023-06-13 [E] [expires: 2025-06-12]

Then use the gpd-id displayed within the pub section to initialise pass, e.g.:

pass init 9F53995439D023FD

Finally, start Docker Desktop:

systemctl --user start docker-desktop 

Hope this helps!


UPDATE: I also ran into problems logging into AWS ECR on Ubuntu with the error:

Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `exit status 1: gpg: public key of ultimately trusted key 9F53995439D023FD not found
gpg: public key of ultimately trusted key 7F525559F4750A05 not found
gpg: public key of ultimately trusted key 3D39C9F57C3C2E11 not found
gpg: public key of ultimately trusted key DCB9A14562B73138 not found
gpg: public key of ultimately trusted key 91B3075B62503284 not found
Password encryption aborted.``

I was able to fix the issue and login to ECR by following the steps in this gist. I'll reproduce them below in case the gist is deleted in the future:

#!/bin/bash

gpg --check-trustdb 2>&1| grep 'not found' | awk '{print $8}' >bad-keys.txt
gpg --export-ownertrust > ownertrust-gpg.txt
mv ~/.gnupg/trustdb.gpg ~/.gnupg/trustdb.gpg-broken
for KEY in `cat bad-keys.txt` ; do sed -i "/$KEY/d" ownertrust-gpg.txt ; done
gpg --import-ownertrust ownertrust-gpg.txt
rm bad-keys.txt ownertrust-gpg.txt
Whicker answered 13/6, 2023 at 11:24 Comment(0)
V
4
  1. first stop docker with this command

    service docker stop

  2. remove old docker config

    rm ~/.docker/config.json

  3. start docker

    service docker start

  4. and then login

    docker login

Varden answered 28/12, 2023 at 12:12 Comment(0)
I
3

I fixed it as below for windows machine,

  1. Go to your C://Users/YOUR_USER_FOLDER

  2. Get inside .docker folder

  3. Remove config.json file

  4. Try login again and it succeeded.

Irony answered 12/4, 2023 at 6:14 Comment(0)
S
3

On mac with intell

I did

sudo chown -R $(id -u):$(id -g) $HOME/.docker

Then changed in file ~/.docker/config.json

The “credsStore” was “desktop” and I changed it to “osxkeychain”.

It works for me

Semidiurnal answered 30/10, 2023 at 8:34 Comment(1)
This solution worked for me as well on an Intel Mac without even needing to change the credStore value Just this line sudo chown -R $(id -u):$(id -g) $HOME/.docker sufficedTiberias
D
2

It's worked for me

service docker stop
rm ~/.docker/config.json
rm /usr/local/bin/docker-credential-pass
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

Discotheque answered 8/1, 2023 at 9:48 Comment(0)
L
2

After trying all of the above method, the issue still persists, use your email id to login rather than your username

Ligroin answered 8/4, 2023 at 6:33 Comment(0)
O
2

No one of these answers seemed to work for me by itself, so I'll share the exact steps I took to get this working in case it helps someone else:

# clear out old config file
rm ~/.docker/config.json
<restart docker desktop>
# clear out and generate fresh gpg keys
pass remove -rf docker-credential-helpers
gpg --generate-key
pass init <keyid>

It's possible that the second set of commands (clearing out and setting up new gpg key) would have worked without clearing out the docker config, but I can say at the very least that clearing out the old config was not sufficient, as the (current) top solution to this question (by Tanjin Alam) had suggested.

Orator answered 31/10, 2023 at 23:50 Comment(0)
C
2

The real answer is you need to use Sudo . Nvidia docs say docker but many cases docker doesnt have permission to login and store if not running as root. THis was my case in WSL2 Unbuntu under windows 11

Castle answered 16/11, 2023 at 23:26 Comment(0)
M
0

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>

Medawar answered 24/9, 2022 at 17:59 Comment(0)
E
0

I changed the value of "credsStore" to "wincred" in config.json and I was able to login with my windows credential

Eponymy answered 25/11, 2022 at 12:41 Comment(0)
T
0

This is usually caused when you use sudo gpg --generate-key in setting up pass. You will have to remove the saved credentials first sudo rm -rf ~/.password-store/docker-credential-helpers sudo rm /root/.docker/config.json then do gpg --generate-key and pass init <generated-key> then attempt docker login again.

Tamatave answered 1/10, 2023 at 15:27 Comment(0)
L
0

for macos m2 following worked for me

sudo chown -R $(id -u):$(id -g) $HOME/.docker
Lethalethal answered 22/10, 2023 at 20:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.