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

Posted on Jan 22, 2022

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/``

Answer

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