Docker Community Forums

Share and learn in the Docker community.

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.

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.


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


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.

That was the golden answer. Cheers

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

Sounds ridiculous solution but it worked!

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

thank you for your infomation.
Nice post!
Merchant crypto

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

thank you for info.
nice post
Merchant crypto