Top Related Projects
Define and run multi-container applications with Docker
Full PHP development environment for Docker.
A reference implementation for the specification that can create and configure a dev container from a devcontainer.json.
Bitnami container images
Quick Overview
Laravel Sail is a lightweight command-line interface for interacting with Laravel's default Docker development environment. It provides a simple way to spin up a Laravel application using Docker, making it easier for developers to set up and manage their local development environment.
Pros
- Easy setup and configuration for Laravel projects
- Consistent development environment across team members
- Includes common services like MySQL, Redis, and Mailhog out of the box
- Seamless integration with Laravel's ecosystem
Cons
- Limited customization options compared to a full Docker setup
- May have a learning curve for developers new to Docker
- Potential performance overhead on some systems due to virtualization
- Not suitable for complex, non-Laravel projects
Getting Started
To get started with Laravel Sail, follow these steps:
- Create a new Laravel project:
curl -s "https://laravel.build/example-app" | bash
- Navigate to the project directory:
cd example-app
- Start the Sail environment:
./vendor/bin/sail up
- Access your Laravel application at
http://localhost
For existing projects, you can install Sail using:
composer require laravel/sail --dev
php artisan sail:install
Competitor Comparisons
Define and run multi-container applications with Docker
Pros of Compose
- More versatile and can be used with any project, not just Laravel
- Offers more advanced configuration options and customization
- Has a larger community and ecosystem of resources
Cons of Compose
- Steeper learning curve for beginners
- Requires more manual setup and configuration
- Less optimized out-of-the-box for Laravel-specific development
Code Comparison
Sail (docker-compose.yml):
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
ports:
- '${APP_PORT:-80}:80'
Compose (docker-compose.yml):
version: '3'
services:
web:
build: .
ports:
- "8000:8000"
db:
image: postgres
environment:
POSTGRES_PASSWORD: example
Sail is designed specifically for Laravel projects, providing a simpler setup with pre-configured services tailored for Laravel development. Compose, on the other hand, offers more flexibility and can be used with any project, but requires more manual configuration.
Sail's configuration is more concise and includes Laravel-specific optimizations, while Compose's configuration is more generic and requires additional setup for Laravel projects. However, Compose's flexibility allows for more complex multi-container applications and custom configurations.
Full PHP development environment for Docker.
Pros of Laradock
- More comprehensive and flexible, supporting a wider range of services and technologies
- Highly customizable, allowing for fine-tuned configurations
- Can be used with multiple projects simultaneously
Cons of Laradock
- Steeper learning curve due to its complexity
- Requires more setup time and configuration
- Larger footprint, consuming more disk space and resources
Code Comparison
Laradock (docker-compose.yml):
version: '3'
services:
workspace:
build:
context: ./workspace
volumes:
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
Sail (docker-compose.yml):
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
volumes:
- '.:/var/www/html'
Laradock offers more granular control over service configurations, while Sail provides a simpler, more streamlined approach tailored specifically for Laravel applications. Laradock's flexibility comes at the cost of increased complexity, whereas Sail prioritizes ease of use and quick setup for Laravel projects. The choice between the two depends on project requirements, team expertise, and desired level of customization.
A reference implementation for the specification that can create and configure a dev container from a devcontainer.json.
Pros of devcontainers/cli
- Language-agnostic, supporting multiple programming languages and frameworks
- Integrates well with Visual Studio Code and other IDEs
- Offers more flexibility in container configuration
Cons of devcontainers/cli
- Steeper learning curve for developers new to containerization
- Requires more manual setup compared to Sail's pre-configured environment
- Less opinionated, which may lead to inconsistencies across projects
Code Comparison
Sail (Laravel):
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.2
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.2/app
ports:
- '${APP_PORT:-80}:80'
devcontainers/cli:
{
"name": "My Dev Container",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/node:1": {}
},
"forwardPorts": [3000]
}
The code snippets show the different approaches to container configuration. Sail uses a Docker Compose file with pre-configured services, while devcontainers/cli uses a JSON configuration file that allows for more customization.
Bitnami container images
Pros of Containers
- Broader application support: Covers a wide range of applications and frameworks beyond Laravel
- Production-ready: Designed for both development and production environments
- Extensive customization options: Offers more configuration possibilities for advanced users
Cons of Containers
- Steeper learning curve: Requires more Docker knowledge compared to Sail's simplified approach
- Less Laravel-specific optimizations: May need additional configuration for Laravel projects
- Larger image sizes: Generally results in larger container images than Sail
Code Comparison
Sail (Docker Compose example):
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.2
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.2/app
Containers (Docker Compose example):
services:
myapp:
image: bitnami/php-fpm:latest
volumes:
- ./:/app
environment:
- PHP_ENABLE_OPCACHE=yes
Both examples show basic service configurations, but Containers requires more manual setup for Laravel-specific needs.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Introduction
Sail provides a Docker powered local development experience for Laravel that is compatible with macOS, Windows (WSL2), and Linux. Other than Docker, no software or libraries are required to be installed on your local computer before using Sail. Sail's simple CLI means you can start building your Laravel application without any previous Docker experience.
Inspiration
Laravel Sail is inspired by and derived from Vessel by Chris Fidao. If you're looking for a thorough introduction to Docker, check out Chris' course: Shipping Docker.
Official Documentation
Documentation for Sail can be found on the Laravel website.
Contributing
Thank you for considering contributing to Sail! You can read the contribution guide here.
Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
License
Laravel Sail is open-sourced software licensed under the MIT license.
Top Related Projects
Define and run multi-container applications with Docker
Full PHP development environment for Docker.
A reference implementation for the specification that can create and configure a dev container from a devcontainer.json.
Bitnami container images
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot