Docker unter WSL2: docker-credential-desktop.exe not found beheben

Docker in WSL2: Fix docker-credential-desktop.exe not found

When building containers or pulling images under WSL2 (the Windows Subsystem for Linux, which provides a full Linux environment), Docker sometimes crashes. This guide shows you how to permanently resolve the missing docker-credential-desktop.exe error in just a few minutes. It is aimed at developers and beginners running Docker inside a Linux distribution on Windows.

Prerequisites

  • A configured WSL2 installation with a Linux distribution such as Ubuntu or Debian on Windows 10.
  • Installed Docker Desktop for Windows with WSL2 integration enabled.
  • A terminal with standard user permissions.
  • Time required: about 5 minutes.

Step 1: Back Up the Configuration File

Before making changes to configuration files, create a backup copy so you can restore the original state at any time.

cp ~/.docker/config.json ~/.docker/config.json.bak

The command completes without output. If no error appears, the backup file config.json.bak exists in your directory.

Step 2: Edit the config.json File

Docker Desktop registers a credential storage helper in your Linux environment that WSL2 often cannot find in the system PATH. Open the configuration file using a text editor in the terminal:

nano ~/.docker/config.json

Look for the line with the credsStore key. The entry usually looks like this:

{
  "credsStore": "desktop"
}

Change the key name from credsStore to credStore or remove the line entirely:

{
  "credStore": "desktop"
}

Save the file in nano with Ctrl + O, confirm with Enter, and exit the editor with Ctrl + X. The change takes effect immediately because Docker disables the failing call to the Windows program inside WSL2.

Alternative Solution: Restart Your Computer

Editing the config.json file works immediately without a reboot. If you prefer not to modify the configuration file manually, restarting your computer is an alternative solution that can resolve the issue directly in some cases.

See also  unRaid Alternatives: The best free alternatives

Verification

Now test whether Docker can access registries normally and handle images again:

docker pull centos:7

Expected output:

7: Pulling from library/centos
Digest: sha256:...
Status: Downloaded newer image for centos:7

If Docker downloads the image without an error message, the issue is resolved.

Troubleshooting

  • Error persists with sudo commands: If you run Docker with sudo, the PATH environment variable is reset for security reasons. Use this instead:
    sudo -E PATH="$PATH" docker pull centos:7
  • docker-credential-desktop.exe: Invalid argument: The Windows binary cannot be executed properly within the WSL environment. Check again whether credsStore was renamed in ~/.docker/config.json as described in Step 2.
  • Symbolic link missing: If modifying the file does not work, create a symlink directly to the installation path:
    sudo ln -s "/mnt/c/Program Files/Docker/Docker/resources/bin/docker-credential-desktop.exe" /usr/bin/docker-credential-desktop.exe

Reverting Changes

If you want to restore the original state, simply copy the backup file back:

cp ~/.docker/config.json.bak ~/.docker/config.json

Conclusion

The error message stems from a miscommunication between WSL2 and the Windows credential helper utility. After this minor text edit, Docker will run without interruption in your Linux console once again. As a next step, you can build your own Dockerfiles error-free.

Sources: Forum: Docker – Forum, forums.docker.com, collabnix.com, zeryther.com

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top