18

I have Windows 10 Professional 2004 build 19041.329.

I have the latest Docker Desktop for windows, and have chosen Ubuntu 18.04 LTS as my WSL distro.

I have set all the proper settings to enable WSL 2 in Docker Desktop, and am able to run commands like docker info without issue.

However, when I try to run docker build -t mytestimage:1.0 . via a Ubuntu terminal, it takes several minutes, and then sends the build context to the docker daemon, but does so VERY slowly.

If I run the same command from a Windows command prompt, it works very quickly

I did not have this problem with WSL 1, and am unsure how to even diagnose what might be wrong and why this is so slow in WSL 2.

AgmLauncher
  • 7,070
  • 8
  • 41
  • 67

1 Answers1

2

I have experienced this problem. It's to do with the way WSL and windows share filesystems. The best solution I have found is to use a bash container when using the Linux filesystem and a powershell prompt when using the windows filesystem. When you use a bash session on the windows filesystem things are very slow. The same problem occurs when trying to access the Linux filesystem with powershell (though that's much harder).

You can get to the Linux filesystem in bash by issuing a cd command to get to your Linux home folder. I do most of my work in this way and it's very fast. From there just use git to clone your repo on the Linux fs and everything will work rapidly.

Alternatively, use powershell to clone your repo into C:/Users/home/git/myproject and you'll find that the system is also responsive, but you're no longer using Linux. I am currently working on a project that needs to use windows executables and I'm forced to work this way with that and have found that it is also fast.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102