Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lukgol26's avatar

laravel12 instalation on wsl2 ubuntu docker windows11

i am new to laravel and programming. Could you tell me how to instal laravel 12 on my wsl2 ubuntu (which is on windows11) with docker? I didnt found any informations in documentation, internet. i am lost...

0 likes
4 replies
LaryAI's avatar
Level 58

To install Laravel 12 on WSL2 Ubuntu with Docker on Windows 11, you can follow these steps. Note that as of my knowledge cutoff in October 2023, Laravel 12 might not be released yet, so I'll provide instructions based on the latest available version, which you can adapt once Laravel 12 is released.

Prerequisites

  1. WSL2 and Ubuntu: Ensure you have WSL2 set up with Ubuntu. You can install it from the Microsoft Store if you haven't already.
  2. Docker Desktop: Install Docker Desktop for Windows and ensure it is configured to use WSL2 as the backend.

Steps to Install Laravel with Docker

  1. Open WSL2 Ubuntu Terminal: Launch your Ubuntu terminal from WSL2.

  2. Install Docker in WSL2: Although Docker Desktop integrates with WSL2, you might need to ensure Docker is accessible from your WSL2 environment. You can verify this by running:

    docker --version
    

    If Docker is not recognized, ensure Docker Desktop is running and WSL integration is enabled in Docker Desktop settings.

  3. Install Composer: Laravel requires Composer, a PHP dependency manager. You can install it using the following commands:

    sudo apt update
    sudo apt install curl php-cli php-mbstring unzip
    curl -sS https://getcomposer.org/installer -o composer-setup.php
    php composer-setup.php --install-dir=/usr/local/bin --filename=composer
    
  4. Set Up a Dockerized Laravel Environment: You can use a pre-built Docker setup for Laravel. One popular choice is the laradock or laravel/sail. Here, I'll show you how to use Laravel Sail, which is the official Docker setup for Laravel.

    • Create a new Laravel project:

      curl -s "https://laravel.build/example-app" | bash
      

      Replace example-app with your desired project name.

    • Navigate to your project directory:

      cd example-app
      
    • Start the Docker containers:

      ./vendor/bin/sail up
      

      This command will build and start the Docker containers defined in the docker-compose.yml file.

  5. Access Your Laravel Application: Once the containers are up and running, you can access your Laravel application by navigating to http://localhost in your web browser.

  6. Develop Your Application: You can now start developing your Laravel application. Use the sail command to run Artisan commands, Composer, and other tools. For example:

    ./vendor/bin/sail artisan migrate
    

Additional Tips

  • Environment Variables: Ensure your .env file is correctly set up, especially the database connection settings, which should match the Docker services.
  • Docker Commands: Familiarize yourself with Docker commands to manage your containers effectively.

By following these steps, you should have a Laravel environment set up on WSL2 Ubuntu with Docker on Windows 11. Adjust the steps as necessary when Laravel 12 is officially released.

RemiM's avatar

If you are new to Laravel and programming in general, forget Docker for now, and start from the beginning, focusing on the basics:

  • HTML
  • CSS
  • JavaScript (optional at first)

I'm not sure if there is HTML only course in Laracasts, however you can find pretty much everything else here: https://laracasts.com/browse/all

Once you feel comfortable enough, you can move to the next step and check the Laravel Path as it offers a full learning path for anything related to PHP and Laravel and beyond.

lukgol26's avatar

@RemiM i have some knoledge in programming. now i want to learn laravel. and now is new laravel 12 and i dont know how to install it.

FrancescoDiMuro's avatar

@lukgol26 You can either use composer with the Laravel installer or Laravel Herd to build things a little bit faster. If I were you, I'd use the Laravel Installer, and depending on the project you want to develop, choose the right choices. Laravel has a great documentation, so stick with it whenever something's not clear, and ask here in case of something you can't find there.

Happy coding!

Please or to participate in this conversation.