Docker-credential-desktop.exe executable file not found in $PATH using wsl2

Using the latest build of Windows 10 and Docker for Windows 19.03.13, I cannot specify image versions in my images using WSL2 and Ubuntu 18.

If I have the line
FROM centos:7
in my Dockerfile, I get and error message saying

failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: rpc error: code = Unknown desc = error getting credentials - err: exec: “docker-credential-desktop.exe”: executable file not found in $PATH, out: ``

The problem seems to go away if I replace the 7 tag with “latest”. The problem does not occur at all if I use Powershell.

The exe is definitely in my PATH, and I can invoke it using

docker-credential-desktop.exe version

I found some discussion on the GitHub Docker for Windows page, but none of the suggestions (e.g. creating a symlink to the exe) work. People on other pages also suggested deleting the config.json file or renaming the credStore property to _credStore. These didn’t work because either the file gets recreated or the property gets changed back.

EDIT:
I get the same problem if I try to log into the Docker repository.

I’d be grateful for any help.

1 Like

Just ran into this. You’re probably running a docker command with sudo?

Try this: sudo -E PATH="$PATH"

By default sudo doesn’t inherit environment variables, and in particular it sets PATH to secure_path from /etc/sudoers. The -E flag tells sudo to inherit environment variables (excluding PATH) which is why we need the PATH="$PATH" too.

Hope this helps.

Thank for that. I was using sudo, which was due to a problem I encountered after I upgraded to WSL2 - I had to run all docker commands with sudo. Eventually I just deleted by WSL image and downloaded a new Ubuntu image. Also, I didn’t realise you don’t need to install the Linux client tools with WSL2. Keeping them installed when I upgraded might have caused the sudo problem.

I got hit by the same, but I am not using sudo anymore.

1 Like

Solution:

In ~/.docker/config.json change credsStore to credStore

67 Likes

I was not using sudo. This worked for me, thanks!

I had encountered this error, but not while running using sudo. Changing credsStore to credStore fixed it immediately.

1 Like

That was the golden answer. Cheers

This worked for me too. Why does it work though?

1 Like

Sounds ridiculous solution but it worked!

1 Like

i’m so overwhelemed i don’t know why but Why it did work ?

I’m running WSL2, and docker was working fine for almost a week. Today I got this issue. Your solution fixed the problem, thank you @bcheronn

this solved my problem

Works for me trying in docker inside docker container :smiley:

Changing credsStore to credStore simply disables that functionality, docker will then run without credentials.

/mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe list failed, complaining it couldn’t find docker-credential-wincred.exe in %PATH%. Docker Desktop 3.4.0 had just been installed fresh on Windows 10.

In this case a reboot solved the problem. Logging the user out and back in again might have done the same.

3 Likes

Restarting the computer fixed it for me. D’oh!

1 Like

Or restarting docker does it too.

WSL2 with Debian for me; had the problem

Why does it work though?

Because when pulling new image, credsStore points to desktop of windows. This requires docker desktop in Windows has to be installed. When remove “s”, that mean docker in WSL cannot locate credsStore property so they will use default docker credentail in linux.

Thank you!

1 Like

It worked for me!! Many Thanks!!

1 Like