Here’s some tips and tricks I’ve learned about from all over the internet while trying to launch a development environment on a Windows 10 with WSL 2 running Docker Desktop and Ubuntu 22.04. I hope some of them will help you not pull your hairs out and save some time.
Install necessary php modules
You might need to install some additional php modules in order to run artisan and composer commands. This is usually needed for a fresh distro install.
Here’s a list of most commonly needed modules:
sudo apt-get install php-cli sudo apt-get install php-curl sudo apt-get install zip unzip php-zip sudo apt-get install php-dom
Or all of the above in one go:
sudo apt-get install php-cli php-dom php-curl zip unzip php-zip
Setting default user and automount
If you’re having issues with running “composer install Operation failed: Operation not permitted” you have to add this to your “wsl.conf” file. Look for it in your WSL distro under “etc” folder.
Add this to any existing lines:
[automount] enabled = true options = "metadata" mountFsTab = false [user] default=YOURDISTROUSERNAME
Append ./vendor/bin/sail to commands
When you need to run commands from the CLI like ‘php artisan migrate’ you should remember to append ‘./vendor/bin/sail’ in order to run in on the container level and not the WSL level.
I will keep updating this blog post with new information when possible. Also do not hesitate to add your tips and tricks in the comment section.