Running docker-compose (nginx/php-fpm) is very slow when the project files are on /mnt/d
(e.g. D:\
).
Installing a fresh Laravel installation took about 4 minutes as opposed to 20 seconds. Opening Laravel's homepage (freshly installed homepage) has a time till first byte of 1.6 to 3.6 seconds as opposed to ~70ms. MySQL keeps restarting.
When running the same docker-compose installation on ~/projects/...
it works very fast (and mysql also just works (no continuous crashing/restarting).
Declaring a mount in the docker-compose.yml file is oddly enough also very fast. Videos have a ttfb of 5ms and download extremely fast.
- /mnt/d/videos:/var/www/html/public/videos
Figured I could have the best of both worlds by just placing my files on D: and then running docker via /mnt/d. But it seems it isn't meant to be?
Tldr; Is writing fito /mnt/<disk letter>
just very slow? And reading files very fast?
This is literally covered in the best practices.
Performance is much higher when files are bind-mounted from the Linux filesystem, rather than remoted from the Windows host. Therefore avoid
docker run -v /mnt/c/users:/users,
where/mnt/c
is mounted from Windows.
https://docs.docker.com/desktop/wsl/best-practices/
Also from Microsoft with regards to WSL2 vs WSL1 and files mounted from Windows.
WSL 1 offers faster access to files mounted from Windows.
- If you will be using your WSL Linux distribution to access project files on the Windows file system, and these files cannot be stored on the Linux file system, you will achieve faster performance across the OS files systems by using WSL 1.
https://learn.microsoft.com/en-us/windows/wsl/compare-versions