Installing Laravel 10 Docker on Windows 11

Installation of Laravel 10 and earlier versions on Windows 11 Docker can be a daunting process. In this article I want show you two easy ways to get it done quickly using Docker containers:

✅ WSL Docker Method

✅ Local Docker Method




WSL Docker Method

The WSL method is the one recommended by Laravel. This is the go to option especially if you are not running Windows 11. More details can be found here: https://laravel.com/docs/10.x#getting-started-on-windows

Step 1. Install WSL
WSL can be installed from the command line. Open a PowerShell prompt as an Administrator (we recommend using Windows Terminal) and run:
PS C:\Users\james> wsl --install

Step 2. Install Docker Desktop
Download and install Docker Desktop for Windows. In the settings enable WSL2 integration (Settings -> Resources -> WSL Integration). Make sure to also enable integration with additional distros.



Step 3. Install Laravel
Open a new WSL terminal and enter the following command:
curl -s https://laravel.build/example-app | bash
$ curl -s https://laravel.build/example-app | bash

This will run the following commands:
$ cd yourAppName
$ ./vendor/bin/sail up

Sails is the wrapper that is used to manage your Laravel application. You can now access the application on your browser: http://localhost

To develop your application you can use Visual Studio Code and enable remote development to your WSL environment, using one of the available free plugins.

Local Docker Method

I personally prefer this method as I run Windows 11 and by default I can have access to certain Linux commands (such as curl and ssh) on the default Windows shell. However, even if you have Windows 10, I recommend installing Git Bash.

Step 1. Install Docker Desktop
Download and install Docker Desktop for Windows.

Step 2. Download the Bitnami Laravel Docker image
Open a git bash terminal and run the following:

$ docker pull bitnami/laravel
$ mkdir ~/myapp && cd ~/myapp
$ curl -LO https://raw.githubusercontent.com/bitnami/containers/main/bitnami/laravel/docker-compose.yml --ssl-no-revoke

Step 3. Enable Docker Privileged Mode
Edit docker-compose.yml to enable privileged mode by adding privileged: true inside your app Docker container properties.


Step 4. Install Laravel
From the git bash terminal within the previous working directory, run: 
$ docker-compose up




You can access the application on your browser: http://localhost:8000/

0 Comments