Skip to main content

Introduction

Laravel Sail is a light-weight command-line interface for interacting with Laravel’s Docker development environment. Sail lets you build a Laravel application using PHP, MySQL, and Redis without requiring prior Docker experience. At its heart, Sail is the compose.yaml file and the sail script stored at the root of your project. The sail script provides a CLI with convenient methods for interacting with the Docker containers defined by the compose.yaml file. Laravel Sail is supported on macOS, Linux, and Windows (via WSL2).
Sail is no longer the default development environment as of Laravel 13. The skeleton’s composer.json no longer includes laravel/sail. A composer setup command is provided instead, and the standard setup uses local PHP with SQLite.
If you need Docker containers, you can still install and use Sail manually.
Sail is intended for local development only. It is not designed for production use. For production deployments, consider Laravel Cloud, Forge, or your own Docker / Kubernetes setup.

Installation

Install in an Existing Project

Install the package via Composer and configure your environment.
1

Require the Sail package

2

Publish the configuration

Run the sail:install Artisan command. It publishes a compose.yaml file to your project root and updates .env with the required environment variables.
An interactive prompt lets you choose services such as MySQL, Redis, and Mailpit.
3

Start Sail

The first run downloads Docker images and may take a few minutes. Once running, access your application at http://localhost.
If you are using Docker Desktop for Linux, run docker context use default to use the default context. If you encounter file permission errors inside containers, set the SUPERVISOR_PHP_USER environment variable to root.

Add More Services

To add a service to an existing Sail installation, use the sail:add command.

Using Devcontainers

To develop inside a Devcontainer, pass the --devcontainer flag.

Configuration

Shell Alias

By default every Sail command requires typing ./vendor/bin/sail. Configure a shell alias to save keystrokes.
Add this line to ~/.zshrc or ~/.bashrc, then restart your shell.
Once the alias is configured you can replace ./vendor/bin/sail with sail throughout all examples in this guide.

Rebuild Images

To ensure all packages are up to date, rebuild your Sail images with the build command.

Starting and Stopping Sail

Start all containers defined in compose.yaml with the up command.
Stop running containers with the stop command or press Ctrl + C if running in the foreground.

Startup Flow


Executing Commands

When using Sail, your application runs inside a Docker container isolated from your local machine. Use sail as the prefix for all PHP, Artisan, Composer, and Node / NPM commands.
The Laravel documentation often shows commands like php artisan, composer, and npm. When using Sail, prefix them with sail so they run inside the container.

PHP Commands

Composer Commands

Artisan Commands

Node / NPM Commands

Container Shell

Open a Bash session directly inside the application container.
Start a Tinker REPL session.

Services

The services below are available when running sail:install or sail:add.

MySQL

Included by default in compose.yaml. Data is persisted in a Docker Volume. On first startup, Sail creates two databases: one for development and a dedicated testing database. Set DB_HOST=mysql in your .env file to connect from the application.
Connect from your local machine using TablePlus or any MySQL client on port 3306.

Redis

Set REDIS_HOST=redis in your .env file.

Valkey

Valkey is a Redis-compatible alternative. Set REDIS_HOST=valkey in your .env file.

Mailpit

Mailpit intercepts emails sent during local development and provides a web UI for preview.
Access the Mailpit web UI at http://localhost:8025 while Sail is running.

Meilisearch / Typesense

Both integrate with Laravel Scout for full-text search.
  • Meilisearch: set MEILISEARCH_HOST=http://meilisearch:7700
  • Typesense: set TYPESENSE_HOST=typesense, TYPESENSE_PORT=8108, etc.

RustFS (S3-compatible storage)

Use RustFS to emulate Amazon S3 locally without creating real S3 buckets.

Running Tests

sail test is equivalent to sail artisan test. Sail creates a dedicated testing database so your tests never interfere with development data.

Laravel Dusk

Run Dusk browser tests without installing Selenium locally. Uncomment the Selenium service in compose.yaml.
On Apple Silicon (M1/M2/M3), use the selenium/standalone-chromium image instead.
Then run your Dusk test suite.

PHP and Node Versions

Changing the PHP Version

Update the build.context for the laravel.test container in compose.yaml.
Rebuild after making changes.

Additional PHP Extensions

Sail’s runtime images include common PHP extensions. If your application requires additional extensions, add a PHP_EXTENSIONS build argument (space-separated) to the laravel.test service in compose.yaml:
Rebuild the container image after updating compose.yaml.

Changing the Node Version

Update build.args in compose.yaml.

Sharing Your Site

Share your local site publicly for colleague previews or webhook testing.
A random laravel-sail.site URL is generated. Configure trusted proxies in bootstrap/app.php to ensure URL helpers work correctly.
Choose a custom subdomain with the --subdomain option.

Debugging With Xdebug

Enable Xdebug

Publish the Sail configuration first, then add the following to your .env file.
Verify that the published php.ini contains the following configuration.
Rebuild your images to apply the changes.

CLI Debugging

Browser Debugging

Follow the instructions from Xdebug to start a debug session from your browser. PhpStorm users should refer to JetBrains’ zero-configuration debugging guide.
Sail relies on artisan serve to serve your application. The XDEBUG_CONFIG and XDEBUG_MODE variables are only supported in Laravel 8.53.0 and later. Earlier versions will not accept debug connections.

Customization

Publish Sail’s Dockerfiles and configuration files to customize your environment.
The files are placed in a docker/ directory at your application root. After making changes, rebuild your containers.

Sail vs. Production

Sail is for local development only. Do not use it in production. For production deployments, consider Laravel Cloud, Forge, Ploi, or a custom Docker / Kubernetes configuration.
Last modified on July 2, 2026