docker / docker-credential-helpers

Programs to keep Docker login credentials safe by storing in platform keystores
MIT License
1.09k stars 172 forks source link

"docker-credential-pass": executable file not found in $PATH #182

Closed iainfogg closed 1 year ago

iainfogg commented 4 years ago

Apologies, this may be the wrong place for this, I'm just not sure where to start as it could be an issue with the credential helper, Docker, the snap or the Ubuntu setup.

I'm running Ubuntu 18.04 with Docker installed via snap, Docker is version 19.03.11.

I'm trying to get docker login to work with pass. pass works fine with my physical key on its own.

My Docker config file in ~/snap/docker/current/.docker/config.json looks like this:

{
        "credsStore": "pass",
    "HttpHeaders": {
        "User-Agent": "Docker-Client/19.03.8 (linux)"
    }
}

I've installed docker-credential-pass in /usr/bin and it's version 0.6.3.

However, when I run docker login, after entering my credentials, I always get this error:

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

docker-credential-pass is in the path, and is found if I run the command directly and if I type which docker-credential-pass. I've even tried putting it in a folder within my home folder which is in the path, in case that helps (I know Docker snap has some restrictions about where on the file system it can access). However, I'm still left with docker login failing to find docker-credential-pass.

Any ideas?

ju1ius commented 4 years ago

Same here with upstream debian buster package. docker-credential-pass extracted to ~/.local/bin

$ which docker-credential-pass
~/.local/bin/docker-credential-pass

My ~/.docker/config.json:

{
  "credsStore": "pass"
}
$ docker login registry.example.com
Error saving credentials: error storing credentials - err: exit status 1, out: `pass not initialized: exec: "pass": executable file not found in $PATH:`

Also tried:

{
  "credsStore": "docker-credential-pass"
}
$ docker login registry.example.com
Error saving credentials: error storing credentials - err: exec: "docker-credential-docker-credential-pass": executable file not found in $PATH, out: ``

:neutral_face:

sourceseek commented 4 years ago

(I know Docker snap has some restrictions about where on the file system it can access)

Looks like you was right. I just moved docker-credential-pass to /usr/local/bin and it's work.

birgersp commented 2 years ago

(I know Docker snap has some restrictions about where on the file system it can access)

Looks like you was right. I just moved docker-credential-pass to /usr/local/bin and it's work.

What does this mean for us that don't use docker-credential-pass?

I mean, what is the workaround when

{
  "credsStore": "pass"
}

yields

https://index.docker.io/v1/: error erasing credentials - err: exec: "docker-credential-pass": executable file not found in $PATH, out: ``
hiage commented 2 years ago
cd /home/youruser
mv .docker .docker-old 

or you can remove it. try again

docker login
thaJeztah commented 1 year ago

looks like this was resolved

laudrup87 commented 9 months ago

When using this "solution", I still get the warning: WARNING! Your password will be stored unencrypted in /home/myusername/.docker/config.json.

So this is not resolved

lucaspottersky commented 9 months ago
# Install "pass" for Linux https://www.passwordstore.org/
sudo apt install pass
# Generate a pub/secret key
gpg --full-generate-key
# Init the pass store
pass init "<KEYID_GENERATED_BY_GPG>"

docker login
itamarr commented 3 months ago

I tried the above solutions to no avail. I am running on a Fedora release 39 virtual machine. I downloaded docker-credential-pass (v 0.8.2) to /usr/local/bin which is in my PATH, and I chmod +x it. I generated a with gpg and ran pass init with the resulting key. I then ran pass insert gitlab-master.private-registry.com and pasted my PAT generated by gitlab. When I run pass ls I do see my saved password, so this seems to work. I tried following docker's instructions and manually store my credentials at docker-credential-pass using $ echo '{ "ServerURL": "gitlab-master.private-registry.com", "Username": "<token>" | sudo docker-credential-pass store This yields the following error: pass not initialized: exit status 1: Error: password store is empty. Try "pass init". even though my pass store isn't empty, as mentioned above.

My /root/.docker/config.json file looks like this: { "credsStore": "pass" } By the way, I also tried { "credStore": "pass"} as suggested elsewhere in the internets. This just makes docker login override the config.json file with unencrypted credentials.

At this stage when I try to login (by echo $TOKEN | sudo docker login gitlab-master.private-registry.com -u <username> --password-stdin as per the instructions) I get the following error: Error saving credentials: error storing credentials - err: exec: "docker-credential-pass": executable file not found in $PATH, out: Even though, as mentioned at the beginning, I checked and docker-credential-pass is indeed reachable. By the way, I even made a link from ~/.local/bin that's also in $PATH, just to be safe.

Just to check, I ran docker-credential-pass list and got: illegal base64 data at input byte 4. This tells me I'm missing something very basic but I'm not sure what.

Final remark, I have also tried copying the mangled unencrypted credentials stored by docker in /root/.docker/config.json and tried using it as the password in pass insert above. That did not work too.

P.S. This might not be the ideal place to ask, but I couldn't find an answer to this anywhere else as well -- say the above would work, i.e., I would have succeeded in storing my credentials with docker-credential-pass. It would seem that I need to use my PAT every time I want to login with docker...? Or am I supposed to login once and never think about it again?

pk0dev commented 2 months ago

I had the same issue that it was throws error when attempt to login on my LMDE

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

when I installed sudo apt install golang-docker-credential-helpers the issue was fixed for me.

itamar-rauch commented 2 months ago

I'm still getting this error on Fedora 39. I don't have exactly golang-docker-credential-helpers there, closest I could find is golang-github-docker-credential-helpers. After installing this, I tried docker login private.registry.com to no avail.

jdh13 commented 5 days ago

hello, it works for me using "pass init" and confgiuring correctly config.json

  1. we need a gpg key gpg --full-generate-key
  2. install packages sudo apt install golang-docker-credential-helpers pass
  3. init pass pass init <gpgp-key-id>
  4. modify config.json { "credsStore": "pass" }

when you start "docker login ...", it asks for your gitlab password, the difference is that it doe not store it in config.json No new idea in my comment, just a little clarification

hth