How to Install Statamic with Docker
Docker is an open source project that streamlines the deployment of an application (or OS) inside a Linux Container. Any dockerized image can run on any machine that is running Docker. You can run Statamic with Docker and never have to configure PHP, Nginx, Apache, or anything else on your local machine.
Overview#
Laravel Sail is a light-weight command-line interface for interacting with Laravel's default Docker development environment. Sail provides a great starting point for building Laravel applications without requiring prior Docker experience, and is a perfect fit for Statamic with a few tweaks.
At its heart, Sail is a docker-compose.yml
file and script that is 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 docker-compose.yml
file.
Laravel Sail is supported on macOS, Linux, and Windows (via WSL2).
Since Sail is the starting point for a new Laravel app, we'll be installing Statamic into a fresh Laravel app.

Installing Docker#
If you don't already have Docker installed, head to docker.com/get-started and download the latest version for your OS.
Installing Laravel#
Follow the install instructions for creating a fresh Laravel app from their documentation.
Install Laravel Sail into your new Laravel app with no additional services, unless you want to get fancy and use MySQL with Statamic (yes, you can do that).
composer require laravel/sail --devphp artisan sail:install --with=noneshellshell
Starting and Stopping Sail#
Before starting Sail, ensure that no other web servers or databases are running on your local computer.

To start all of the Docker containers defined in your site's docker-compose.yml
file, execute the up command:
./vendor/bin/sail upshellshell
To start all of the Docker containers in the background, start Sail in "detached" mode:
./vendor/bin/sail up -dshellshell
Once the application's containers have been started, your project can be accessed in the browser at: http://localhost.
To stop all of the containers, press Control
+ C
. Or if the containers are running in the background, use the stop command:
./vendor/bin/sail stopshellshell
Installing Statamic#
At this point you're running Laravel without Statamic in it. Time to change that.
You can now follow the steps to install Statamic into Laravel.
Keep in mind that commands need to be run inside Sail.
- Instead of
php artisan
, runsail artisan
- Instead of
composer require
, runsail composer require
- Instead of
php please
, runsail artisan statamic

Learn more about Laravel Sail#
The Laravel Sail docs cover a lot more of what you can do with Sail. Check them out!
Docs Feedback
Submit improvements, related content, or suggestions through Github.
Betterify this page