Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Docker for Windows running slow on WSL2?

I was trying to get a Laravel image up and running on Docker for Windows (Windows 11), and after config, it was taking several seconds to load each page (insanely slow, definitely outside Laravel benchmarks). I am using WSL2 and have native (full resources) allocated to the VM. Why is it running so slow?

I inspected resource allocation and it shouldn't be a problem (50% memory and all cores). I have a fairly beefy machine. I tried a reinstall and new Docker image and closed all competing tasks.

like image 612
Steven Mann Avatar asked Oct 27 '25 02:10

Steven Mann


1 Answers

TL;DR: don't host docker files on the WSL mount. Either use non-WSL docker or do an SSH deployment to the WSL local filesystem.

The issue ended up being that my project files were loaded under /mnt/c in WSL, and, for some reason, this is VERY inefficient for file access and modification. I ended up moving my files to a local folder in the VM (for me, this was my home folder) and page loads reduced to sub-second. Just the move (mv x->y) took a few minutes and my fans were going crazy.

like image 129
Steven Mann Avatar answered Oct 29 '25 17:10

Steven Mann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!