Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharing docker credentials between Window and WSL

Environment

  • Windows version and build Version 2004 (OS Build 19037.1)
  • Docker Edge version 2.1.6.1
  • Ubuntu 18.04 on WSL 2

Current setup and status:

  • docker installed on windows
  • created aliases for docker, docker-compose, docker-credential-desktop, etc ...

Running commands such as docker build, docker ps, docker pull, docker images all work fine. Now I would like push an image and so of course I have to login first.

Problem: logging into docker hub.

  • I run docker login in the WSL terminal
  • I put in my username and password
  • I get the following error
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in %PATH
%, out: ``

What I've tried so far

docker login from powershell works fine. So I created a symbolic link between /mnt/c/Users/<winusername>/.docker and /home/<wslusername>/.docker. The equivalent works fine for .aws, but for .docker it was not able to share or even acknowledge the credentials, so it asked again for the user and password and threw the same error as above.

like image 571
Mark Chassy Avatar asked Aug 10 '26 20:08

Mark Chassy


1 Answers

This worked for me,

sudo  ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe /usr/bin/docker-credential-desktop.exe

Linking the executable from windows path to linux path or you can add the windows PATH on you linux PATH.

Refer: https://github.com/docker/for-win/issues/6652

like image 66
Antonio Marques Avatar answered Aug 15 '26 00:08

Antonio Marques