Packages
Laravel Sail
Introduction
Laravel Sail is a light-weight command-line interface for interacting with Laravel's default Docker development environment. Sail was always a Bash script, so Laravel Bash's Sail is the most authentic part of the project.
./sail up -d
./sail artisan migrate --seed
./sail test
./sail down
Why Docker?
Laravel Bash needs Bash 5.1 for wait -n -p and GNU versions of sed, sort, grep and tail. macOS ships Bash 3.2 from 2007, licensed under GPLv2, and BSD tools whose flags differ: sed -i wants an argument on a Mac and doesn't on Linux.
So ./sail itself is careful to run on Bash 3.2, and everything else runs in a container.
Why Debian, not Alpine?
The obvious image is bash:5 on Alpine, which is tiny. But Alpine's sed, awk, grep and nc come from BusyBox, which doesn't have grep --line-buffered, sort -g, tail -F or column. Laravel Bash uses debian:bookworm-slim and installs what it needs:
apt-get install -y --no-install-recommends \
bash coreutils procps util-linux bsdextrautils socat sqlite3 \
postgresql-client jq curl ca-certificates bats shellcheck
Services
| Service | Image | What it runs |
|---|---|---|
app | debian:bookworm-slim | ./artisan dev, on port 8000 |
pgsql | postgres:17 | Postgres, with a health check so app waits for it |
The project folder is mounted into app, so changes to any file apply on the next request, without a restart. Long-running processes (the queue workers, the listener and the scheduler) need ./sail restart app.
Commands
| Command | Runs |
|---|---|
./sail up, down, ps, logs, restart | docker compose |
./sail artisan ... | ./artisan in the app container |
./sail test | ./artisan test |
./sail shell | bash in the app container |
./sail psql | psql in the pgsql container |
./sail sqlite | sqlite3 on the SQLite database |
./sail passes DB_CONNECTION through when it's set on your machine, so DB_CONNECTION=pgsql ./sail artisan migrate does what it looks like.