Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to login to Docker on Ubuntu 18 using credential store

Tags:

docker

ubuntu

I can't login to docker using docker login.

I'm executing:

sudo docker login --username USERNAME --password PASSWORD

I'm getting the following error:

Error saving credentials: error storing credentials - err: exec: 
"docker-credential-pass": executable file not found in $PATH, out: ``

I tried to search for a similar errors, but didn't really find anything relevant.

I'm using:

Ubuntu 18.10.

Docker version 18.06.0-ce, build 0ffa825.

Why is this happening?

like image 544
sr9yar Avatar asked Aug 13 '18 20:08

sr9yar


2 Answers

The message you're getting is stating that the docker-credential-pass credential helper program needed for storing passwords in pass (www.passwordstore.org) can't be found in your system path. This also means that your credential store is configured to use pass. Inside ~/.docker/config.json, there should be something that looks like this:

{
     "credsStore": "pass"
}

If you want to continue to use pass as a credential manager, you'll need to install the docker-credential-pass credential helper (https://github.com/docker/docker-credential-helpers).

The install instructions on the site are currently unclear (as of 09/21/2018) but the best guide I found was opened in one of the issues in the docker-credential-helpers project:

https://github.com/docker/docker-credential-helpers/issues/102

Of course, if you are just not wanting to use a credential store, remove the line that specifies the credential store from the configuration, or set it to "". Be aware though that you'll get warning messages about your docker login credentials like this:

WARNING! Your password will be stored unencrypted in /home/foo/.docker/config.json.

For more information, you can look at the Docker login information page:

https://docs.docker.com/engine/reference/commandline/login/#credentials-store

like image 67
jhrabi Avatar answered Oct 17 '22 20:10

jhrabi


I had the same problem. I have a guess as to why this is happening and I give a solution below that worked for me.

Cause: I suspect this is a packaging error with snap. I had installed docker using the GUI installer Ubuntu Software which installs it as a snap app. This seems to cause some unusual behavior. In particular it appears that docker login does not have access to the user's PATH environment variable and thus it cannot find the docker-credential-pass executable no matter where you put it. (Or, maybe there is some magic place it could go, but it wasn't clear to me how to find out what location would work -- none of /bin /snap/bin /usr/bin or /usr/local/bin worked for me.) I imagine this has something to do with the way the client's host $PATH is configured by the installer, given the docker docs https://docs.docker.com/engine/reference/commandline/login/ which say

Docker requires the helper program to be in the client’s host $PATH.

So, my best guess is that it is packaged wrong and the $PATH visible to docker login is the empty string.

Solution: In any case this suggests the fix (which worked for me) of not using a snap install via the GUI installer. So:

  1. Uninstall docker using the GUI in Ubuntu Software.
  2. Reinstall docker using the instructions on https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04.

Then I was able to place docker-credential-pass in my $PATH and docker login then finally behaved as expected.

Hope this helps.

like image 2
Shaun Harker Avatar answered Oct 17 '22 19:10

Shaun Harker