Laravel Sail pages take seconds to load on Windows with WSL2
Is Laravel really this slow?Short answer
On Windows, Laravel Sail is slow when the project lives on the Windows drive (under /mnt/c) and Docker bind-mounts it into the container. Move the project into the WSL Linux filesystem and open it from there. Then check the memory and CPU limits given to WSL.
Fix it fast
1Find out which cause you have
Print the current folder from the WSL shell. A path that starts with /mnt/c means the project is on the Windows drive.
pwd2Match what you see, then jump to its fix
- 1
pwd shows /mnt/c/Users/...The project is stored on the Windows filesystemFix - 2
Hot reload or file watchers in the container do not notice edits.File-change watching does not work from the Windows driveFix - 3
The first fix helped little, and the machine is short on memory when containers run.WSL has too little memory or CPUFix
- 1
What does the error look like?
Is Laravel really this slow?pwd prints a path that starts with /mnt/c
Cause 1 of 3
The project is stored on the Windows filesystem
1Check
Microsoft says the fastest place for files used from a Linux shell is the WSL file system, for example /home/<user>/Project, and not /mnt/c. Docker says the same about bind mounts: performance is much higher from the Linux filesystem.
pwd
ls -ld ~2Fix
Copy the project into your Linux home directory and run Sail from there. Open it in your editor through WSL.
cp -r /mnt/c/Users/me/my-app ~/my-app
cd ~/my-app
./vendor/bin/sail up -d3Verify
Reload the page and compare. You can browse the Linux files from Windows at \\wsl$.
explorer.exe .Confirmed by learn.microsoft.com
Cause 2 of 3
File-change watching does not work from the Windows drive
1Check
Docker documents that containers only get inotify file-change events when the source files are on the Linux filesystem.
pwd2Fix
Keep the project and everything bind-mounted into the container in the Linux filesystem.
# store the project under ~/ and mount ~/my-app into the container, not /mnt/c/...3Verify
Edit a file and confirm the watcher reacts.
./vendor/bin/sail npm run devConfirmed by docs.docker.com
Cause 3 of 3
WSL has too little memory or CPU
1Check
Docker notes that the memory, CPU and swap given to the WSL 2 virtual machine are set in .wslconfig.
free -h2Fix
Adjust the limits in .wslconfig using the options in Microsoft's WSL configuration guide, then restart WSL.
# edit .wslconfig as described in Microsoft's WSL configuration guide, then restart WSL3Verify
Start Sail again and watch the response time.
./vendor/bin/sail up -dConfirmed by docs.docker.com
How do I stop it coming back?
- Create new Laravel projects inside the WSL home folder from the start.
- Run composer, artisan and npm through sail so they use the container's tools.
- Treat /mnt/c paths as a sign the project is in the wrong place for Docker work.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
Related fixes
Back end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
php artisan serve starts but the app is not reachable, or the .env is ignored
Server stops right after start with a non-zero exit code when --port is given and the port is busy
php artisan serve listens on 127.0.0.1 port 8000 by default.
4 causes, each with a fixBack end
Guzzle or Http::get fails with cURL error 6 in Laravel
Illuminate\Http\Client\ConnectionException: cURL error 6: Could not resolve host
cURL error 6 means the machine running PHP could not turn the host name in the URL into an IP address.
3 causes, each with a fixBack end
Sail image build stops at groupadd with an invalid group ID
The sail build works through ./vendor/bin/sail but not through plain docker compose
The Sail Dockerfile runs groupadd with the WWWGROUP build argument.
2 causes, each with a fixBack end
sail up fails because Docker cannot find the project's compose file
no configuration file provided: not found
Sail is a thin wrapper around Docker Compose, and Compose found no compose file to read.
3 causes, each with a fixBack end
sail up fails with a permission error
WARNING: Error loading config file: /home/user/.docker/config.json - stat /home/user/.docker/config.json: permission denied
A permission error from sail up has three documented sources on Linux: Docker Desktop is using the wrong context, files inside the container are not writable by the container user, or Docker's own config folder is owned by root from an earlier sudo run.
3 causes, each with a fix