Long working directory in bash when Docker desktop is running in WSL2

Viewed 1087

I have Docker Desktop running with WSL 2 backend. I also have Ubuntu 20.04 installed as my default WSL2 Linux distro. The problem I am facing is that if I launch C:\Windows\System32\wsl.exe when Docker is running then the shell is initialized with a very long directory path: /mnt/wsl/docker-desktop-bind-mounts/Ubuntu-20.04/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1/mnt/c/Windows/System32

However, if I shutdown docker and start a WSL shell again, then it starts at the expected path: /mnt/c/Windows/System32

I can cd into /mnt/c myself but it is annoying that it doesn't start on the right path. I also tried running wsl -d "Ubuntu-20.04 to no avail. It seems that my C volume is mounted on both /mnt/c and the long ugly path above.

Has anyone experienced and resolved this issue?

Docker Version: 2.3.0.3 (45519)

2 Answers

It seems to work okay if I start Docker desktop first and then WSL.

I've solved this issue by disabling WSL integration option in Docker settings in Windows at Settings > Resources > WSL Integration

Related