LaraflareDocsFrameworkPackagesReleases13.x

Docs / Packages / Sail

Sail

Introduction

Sail (@laraflare/sail) sets up a Docker development environment for the services your application uses. Sail provides a great starting point for running MySQL, Redis, Mailpit and other services beside your Laraflare application without requiring prior Docker experience.

At its heart, Sail is the compose.yaml file that is stored at the root of your project. The services it defines run in Docker containers, started with Docker Compose.

Sail is supported on macOS, Linux, and Windows (via WSL2).

Note

Laraflare's Sail does not include the sail script or Sail's application container images. Your application runs on your own machine, with npm run dev or npx artisan serve (installation), and connects to the services in their containers. The compose.yaml file still has Sail's application service (the first entry in services), whose image is not available, so start the services by name (below) or remove that service from the file.

Installation and Setup

You may install Sail using npm:

npm install --save-dev @laraflare/sail

After Sail has been installed, you may run the sail:install Artisan command. This command will publish Sail's compose.yaml file to the root of your application and modify your .env file with the required environment variables in order to connect to the Docker services:

npx artisan sail:install

You may name the services to install with the --with option instead of choosing them interactively:

npx artisan sail:install --with=mysql,redis,mailpit

The available services are mysql, pgsql, mariadb, mongodb, redis, valkey, memcached, meilisearch, typesense, rustfs, mailpit, mailtrap-local, rabbitmq, selenium and soketi.

Warning

If you are using Docker Desktop for Linux, you should use the default Docker context by executing the following command: docker context use default.

Adding Additional Services

If you would like to add an additional service to your existing Sail installation, you may run the sail:add Artisan command:

npx artisan sail:add

Starting and Stopping Sail

Sail's compose.yaml file defines a variety of Docker containers that work together to help you build Laraflare applications. Each of these containers is an entry within the services configuration of your compose.yaml file.

Before starting Sail, you should ensure that no other databases are running on your local computer on the same ports. To start the containers of the services you installed in the background, pass their names to Docker Compose's up command:

docker compose up -d mysql redis mailpit

To stop all of the containers, you may use the stop command:

docker compose stop

Note

sail:install writes each service's container name as its host in your .env file (DB_HOST=mysql, REDIS_HOST=redis, MAIL_HOST=mailpit), which is how a container reaches another container. Your application runs on your machine, where each service is forwarded to 127.0.0.1: set those hosts to 127.0.0.1.

Interacting With Databases

MySQL

As you may have noticed, your application's compose.yaml file contains an entry for a MySQL container. This container uses a Docker volume so that the data stored in your database is persisted even when stopping and restarting your containers.

The first time the MySQL container starts, it will create a database named using the value of your DB_DATABASE environment variable, for your local development.

Note

The MySQL, MariaDB and PostgreSQL entries in compose.yaml also mount a script, create-testing-database, that creates a second testing database. Laraflare's Sail does not include that script, so remove that line from the service's volumes before starting it the first time.

Once you have started your containers, you may connect to the MySQL instance within your application by setting your DB_HOST environment variable within your application's .env file to 127.0.0.1.

To connect to your application's MySQL database from your local machine, you may use a graphical database management application such as TablePlus. By default, the MySQL database is accessible at localhost port 3306 and the access credentials correspond to the values of your DB_USERNAME and DB_PASSWORD environment variables. Or, you may connect as the root user, which also utilizes the value of your DB_PASSWORD environment variable as its password.

Redis

Your application's compose.yaml file also contains an entry for a Redis container. This container uses a Docker volume so that the data stored in your Redis instance is persisted even when stopping and restarting your containers. Once you have started your containers, you may connect to the Redis instance within your application by setting your REDIS_HOST environment variable within your application's .env file to 127.0.0.1.

To connect to your application's Redis database from your local machine, you may use a graphical database management application such as TablePlus. By default, the Redis database is accessible at localhost port 6379.

Valkey

If you choose to install Valkey service when installing Sail, your application's compose.yaml file will contain an entry for Valkey. This container uses a Docker volume so that the data stored in your Valkey instance is persisted even when stopping and restarting your containers. You can connect to this container in your application by setting your REDIS_HOST environment variable within your application's .env file to 127.0.0.1.

To connect to your application's Valkey database from your local machine, you may use a graphical database management application such as TablePlus. By default, the Valkey database is accessible at localhost port 6379.

Meilisearch

If you chose to install the Meilisearch service when installing Sail, your application's compose.yaml file will contain an entry for this powerful search engine that is integrated with Scout. Once you have started your containers, you may connect to the Meilisearch instance within your application by setting your MEILISEARCH_HOST environment variable to http://127.0.0.1:7700.

From your local machine, you may access Meilisearch's web based administration panel by navigating to http://localhost:7700 in your web browser.

Typesense

If you chose to install the Typesense service when installing Sail, your application's compose.yaml file will contain an entry for this lightning fast, open-source search engine that is natively integrated with Scout. Once you have started your containers, you may connect to the Typesense instance within your application by setting the following environment variables:

TYPESENSE_HOST=127.0.0.1
TYPESENSE_PORT=8108
TYPESENSE_PROTOCOL=http
TYPESENSE_API_KEY=xyz

From your local machine, you may access Typesense's API via http://localhost:8108.

File Storage

If you plan to use Amazon S3 to store files while running your application in its production environment, you may wish to install the RustFS service when installing Sail. RustFS provides an S3 compatible API that you may use to develop locally using Laraflare's s3 file storage driver without creating "test" storage buckets in your production S3 environment. If you choose to install RustFS while installing Sail, a RustFS configuration section will be added to your application's compose.yaml file.

By default, your application's filesystems configuration file already contains a disk configuration for the s3 disk. In addition to using this disk to interact with Amazon S3, you may use it to interact with any S3 compatible file storage service such as RustFS by simply modifying the associated environment variables that control its configuration. For example, when using RustFS, your filesystem environment variable configuration should be defined as follows:

FILESYSTEM_DISK=s3
AWS_ACCESS_KEY_ID=sail
AWS_SECRET_ACCESS_KEY=password
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=local
AWS_ENDPOINT=http://127.0.0.1:9000
AWS_USE_PATH_STYLE_ENDPOINT=true

Previewing Emails

Sail's default compose.yaml file contains a service entry for Mailpit. Mailpit intercepts emails sent by your application during local development and provides a convenient web interface so that you can preview your email messages in your browser. Mailpit is available via port 1025:

MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_ENCRYPTION=null

When Mailpit is running, you may access the Mailpit web interface at: http://localhost:8025

If you chose to install the Mailtrap Local service when installing Sail, or added it later using the sail:add Artisan command, your application's compose.yaml file will contain an entry for this email catcher instead. Mailtrap Local is available via port 3535:

MAIL_HOST=127.0.0.1
MAIL_PORT=3535

When Mailtrap Local is running, you may access the Mailtrap Local web interface at: http://localhost:3550

© 2026 Hugh Smith. Adapted from Laravel's documentation, Copyright (c) Taylor Otwell, used under the MIT License.