
Run this command to start a new instance of VS Code opened from the current location:. Once finished, go to the new directory cd example-app. That should do the trick and you will be able to run the command. Under Resources, open WSL integration and check in which WSL distros you want to access Docker from. What I had to go to Docker desktop settings (You can right click on Docker Desktop icon in systray and select Settings). Note: In my case, when I first run this command, I got this error output: Do not worry for now, if you don't know what is that - I will explain later. The other query argument devcontainer instructs sail to create a default devcontainer.json file for us. In particular, it's going to be MySql and Redis. Since I want to use other components, not just Laravel itself, I'm specifying those in with query parameter. Now, when you are in the target directory, run this command In my case \\wsl.localhost\Ubuntu-22.04\home\miloslav ~ works fine and you can always access it from Windows through network share. It's better to create the directory outside of /mnt/c, e.g. When I first wrote this tutorial I used /mnt/c/Miloslav/Projects/Recent/laravel_test/example-app but one careful reader (thanks Ken Verhaegen) has point out to me that this is not ideal for performance reasons. Getting the Laravelįirst, in Windows press Win + R and type wsl, hit ENTERĬreate a directory where are you going to work on the project. Particularly when dealing with some issues that are not going to apply to you.
Now, I'm going to use Windows in this tutorial, but you should be able to follow with any other OS. Remote Development pack extension (In reality you would just need WSL and Dev Containers extension, but let's install the whole package).We will use a tool called Laravel Sail - a command-line tool that should simplify the whole process and shield us from the complexities of such a setup. You want to be able to set everything up, as you had it before, and start to work quickly.
Even if it was some time ago and you have a new computer. Or when you are done with the project and you leave it for a while, then return to it, you want to be able to start where you finished. You want to keep the project separate from your local environment. Or if being part of the team isn't your thing, you might want a standardized environment for yourself as well. They can have different operating systems and use different development tools or IDEs, but you want to have one unified environment with all the required dependencies. Imagine you are part of the team and you want each member to develop in one standardized environment.