Sail Artisan Migrate: A Guide to the Sailing Lifestyle

Embrace the Sailing Life: A Guide to Sail Artisan Migrate

Apr 14 2025

Embrace the Sailing Life: A Guide to Sail Artisan Migrate

Laravel and Docker: A guide to using Laravel Sail

Samson Omojola I'm an experienced software engineer. I love creating applications with responsive, beautiful, intuitive, state-of-the-art designs. I'm skilled in HTML, CSS, JavaScript, Ionic, React, PHP, Laravel, and Flutter.

Introducing Galileo AI

LogRocket’s Galileo AI watches every session, surfacing impactful user struggle and key behavior patterns.

Step 2: Taking a close look at your application

Now your development environment is up and running. With Docker, every container holds one service only. This means that our Sail application comes with three services: one for PHP, one for MySQL, and a third for Redis.

These three containers are housed and managed by Docker Compose, using the docker-compose.yml file in the root of your project. If you open this file, you’ll see a services section with three components: laravel.test , mysql , and redis :

laravel.test handles the PHP component and the other two handle what their names suggest.

mysql: image: 'mysql:8.0' ports: - '$:3306' environment: MYSQL_ROOT_PASSWORD: '

Step 1: Installing and configuring Sail

Every new Laravel application comes with Sail out of the box. It only requires one simple command to spin it up.

Run the following command to create a new Laravel application:

curl -s https://laravel.build/new-sail-application | bash


Next, navigate into the project directory:

cd new-sail-application

To kickstart Sail, run the following command:

./vendor/bin/sail up " data-image-title="Laravel-Sail-Screenshot2" data-image-description="" data-image-caption="" data-medium-file="https://blog.logrocket.com/wp-content/uploads/2021/05/Laravel-Sail-Screenshot2.png?w=300" data-large-file="https://blog.logrocket.com/wp-content/uploads/2021/05/Laravel-Sail-Screenshot2.png?w=958" src="https://blog.logrocket.com/wp-content/uploads/2021/05/Laravel-Sail-Screenshot2.png" alt="Screenshot of Laravel Sail New Project Startup" width="958" height="640" srcset="https://blog.logrocket.com/wp-content/uploads/2021/05/Laravel-Sail-Screenshot2.png 958w, https://blog.logrocket.com/wp-content/uploads/2021/05/Laravel-Sail-Screenshot2.png?resize=300,200 300w, https://blog.logrocket.com/wp-content/uploads/2021/05/Laravel-Sail-Screenshot2.png?resize=768,513 768w" sizes="auto, (max-width: 958px) 100vw, 958px" />

Laravel Sail: How To Containerize Your Application

In any modern web development, a developer is required to bundle their source code and deploy it to a server so that it can be accessible to the public. One way is through virtualization. This concept allows a developer to rent a virtual machine from a cloud provider and configure it by installing all the necessary dependencies such as the web server, the firewall and a database server. This introduces the complexities of knowing all the various steps required to configure a successful virtual machine to host an application. What if there is a better way of reducing these complexities? In comes Laravel Sail to help us Containerize.

Containerization abstracts the need of knowing how to efficiently configure a virtual machine and host an application. It allows a developer to use their set of dependencies specific to their application and isolate it into a container. A container is just an isolated instance containing all the application dependencies. Think of it as a bucket. In this bucket, we can have our Laravel 8.0 application, a MYSQL database and a default PHP 7 instance. Another bucket could have a Laravel 9 application, a Mysql database, and PHP 8 instance. if we were to virtualize them, it would be a big headache to know which PHP version is the default and would cause one of the applications to break. To mitigate this, we can containerize both the applications and have them run as isolated instances on the same virtual machine. Laravel Sail allows us to containerize our Laravel application.

Containerization allows us to manage versioning in our development and production environments with ease.

Chhaya Mehrotra

Tegs: