Docker build command hangs in WSL 2 Ubuntu 18.04 Docker build command hangs in WSL 2 Ubuntu 18.04 docker docker

Docker build command hangs in WSL 2 Ubuntu 18.04


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.