Auto-translation used

Configuring the Laravel 10 Development Environment using Docker

Docker containers are a way to launch applications. They create a completely isolated development environment and allow you to run complex and dependency—demanding applications inside yourself, while not installing anything on the server itself - all manipulations are performed exclusively inside containers.Laravel Sail is available to create a container. Laravel Sail is a lightweight command-line interface for interacting with the default Docker Laravel development environment. Sail is an excellent starting point for creating a Laravel application using PHP, MySQL and Redis without prior experience with Docker.

Installing Laravel sail

Before we create a new Laravel application on your Windows computer, be sure to install Docker Desktop. Then you need to make sure that the Windows subsystem for Linux 2 (WSL2) is installed and enabled. WSL allows you to run Linux binary executables natively on Windows 10. Information on how to install and enable WSL2 can be found in the Microsoft Developer Environment documentation.

Then you are ready to create your first Laravel project. Launch Windows Terminal and start a new terminal session for your WSL2 Linux operating system. Then you can use a simple terminal command to create a new Laravel project. For example, to create a new Laravel application in a directory called "example-app", you can run the following command in your terminal:

curl -s | bash

Of course, you can change the "sample application" in this URL to whatever you like - just make sure that the application name contains only alphanumeric characters, dashes and underscores. The Laravel application directory will be created in the directory from which you run the command.

The installation of Sail may take several minutes while the Sail application containers are built on your local machine.

After creating the project, you can go to the application catalog and launch Laravel Sail. Laravel Sail provides a simple command line interface for interacting with the default Docker Laravel configuration:

cd example-app
./vendor/bin/sail up

After launching the Docker containers of the application, you can access the application in your web browser at: http://localhost .

Comments 2

Login to leave a comment