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.
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.
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.
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!