Switching from Docker Desktop to Rancher Desktop on WSL2: Solving the Missing docker-credential-desktop.exe Error
Switching from Docker Desktop to Rancher Desktop on WSL2:
Solving the Missing docker-credential-desktop.exe Error
I’ve been happily running Kamal inside WSL2 on my home
Windows desktop for a while. My original setup included an older Docker Desktop
installation. Recently, I wanted to replicate this environment on a different
machine, but I discovered that Docker Desktop had changed their licensing
terms. Technically, I’m still covered by the new licensing terms, but I decided
to try Rancher Desktop
instead.
Installing Rancher Desktop on WSL2
Installation was straightforward. I installed Rancher
Desktop, configured it to integrate with WSL2, and disabled Kubernetes (since I
don’t currently need it). My plan was to continue using the Docker CLI inside WSL2
alongside Rancher Desktop for container management.
The Authentication Error
However, when I was in WSL and tried to authenticate (for example, with Docker
Hub via docker login), I ran into this error:
```
failed to store tokens: error storing credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``
error storing credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``
```
I checked whether docker-credential-desktop.exe was
available by running:
```
which docker-credential-desktop.exe
```
The Underlying Issue
The Docker CLI uses a credential helper to securely store
(and retrieve) credentials. Under Docker Desktop on Windows, that helper is
usually docker-credential-desktop.exe. But since I don't use Docker Desktop, that file
no longer existed on my system, causing the docker login command to fail when
it tried to store tokens.
The Quick Fix: Downloading the Missing Credential Helper
Fortunately, I discovered that you can download the Docker credential helper (docker-credential-wincred) directly from GitHub and place it in your WSL2 environment so that the CLI can use it. Here’s what I did:
1. Find the latest release version:
```
wincred_version=$(curl -fsSL -o /dev/null -w "%{url_effective}" https://github.com/docker/docker-credential-helpers/releases/latest | xargs basename)
```
2. Download and rename it to docker-credential-desktop.exe:
```
sudo curl -fL -o /usr/local/bin/docker-credential-desktop.exe \
"https://github.com/docker/docker-credential-helpers/releases/download/${wincred_version}/docker-credential-wincred-${wincred_version}.windows-$(dpkg --print-architecture).exe"
```
3. Make it executable:
```
sudo chmod +x /usr/local/bin/docker-credential-desktop.exe
```
With these steps, docker-credential-desktop.exe was now
available in my WSL2 environment, and Docker can call it to store tokens.
Testing It Out
After placing docker-credential-desktop.exe in /usr/local/bin
and making it executable, both docker login and Kamal commands like kamal setup
and kamal deploy worked without issues. The Docker CLI can once again properly
store credentials, and I can use Rancher Desktop as my container runtime on
Windows with WSL2.
Final Thoughts
If you’re transitioning from Docker Desktop to Rancher
Desktop on Windows + WSL2, you might encounter the same missing credential
helper error. By manually downloading the docker-credential-desktop.exe file,
you can keep using the familiar Docker CLI login mechanism. It’s a quick
solution that avoids any manual reconfiguration of Docker’s credential storage.
Comments
Post a Comment