composer require laravel/sail --dev
php artisan sail:installcurl -s https://laravel.build/my-app | bash
cd my-app && ./vendor/bin/sail up./vendor/bin/sail up # Start all services
./vendor/bin/sail up -d # Start in detached mode
./vendor/bin/sail down # Stop all services
./vendor/bin/sail restart # Restart servicesalias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'sail artisan migrate
sail artisan make:controller UserController
sail artisan queue:work
sail artisan tinkersail composer install
sail composer require package/name
sail composer update
sail composer dump-autoloadsail npm install
sail npm run dev
sail npm run build
sail yarn install
sail yarn devsail mysql # Connect to MySQL
sail mysql -u root -p # Connect as rootsail artisan migrate
sail artisan migrate:fresh
sail artisan migrate:fresh --seed
sail artisan db:seedsail test # Run all tests
sail test --filter=UserTest # Run specific test
sail test --coverage # Run with coveragesail pest
sail pest --filter=usersail artisan queue:work
sail artisan queue:listen
sail artisan queue:restart
sail artisan queue:failedsail root-shell
chown -R sail:sail /var/www/html/storage
chown -R sail:sail /var/www/html/bootstrap/cachesail shell # Access as sail user
sail root-shell # Access as root user- App: http://localhost
- MySQL: localhost:3306
- Redis: localhost:6379
- Mailhog: http://localhost:8025
- Minio: http://localhost:9000
sail ps
docker pssail exec app bash # Execute bash in app container
sail logs # View logs
sail logs -f # Follow logs# Backup
sail exec mysql mysqldump -u sail -ppassword laravel > backup.sql
# Restore
sail exec -T mysql mysql -u sail -ppassword laravel < backup.sqlsail artisan sail:publish # Publish Sail configuration# .env file
APP_PORT=80
FORWARD_DB_PORT=3306
FORWARD_REDIS_PORT=6379
FORWARD_MEILISEARCH_PORT=7700
FORWARD_MAILHOG_PORT=1025
FORWARD_MAILHOG_DASHBOARD_PORT=8025Add to docker-compose.yml:
selenium:
image: 'selenium/standalone-chrome'
volumes:
- '/dev/shm:/dev/shm'
networks:
- sailsail up # Xdebug enabled by default in local
sail shell
php -v # Check if Xdebug is loadedsail logs app
sail logs mysql
sail logs redissail build --no-cache
sail up -dsail artisan config:cache
sail artisan route:cache
sail artisan view:cache
sail artisan optimize# Port conflicts
sail down && sail up
# Permission issues
sail root-shell
chown -R sail:sail /var/www/html
# Clear caches
sail artisan cache:clear
sail artisan config:clear
sail artisan view:clear
# Rebuild containers
sail build --no-cachesail down -v # Remove volumes
docker system prune -a # Clean Docker system
sail up -d # Restart fresh| Command | Description |
|---|---|
sail up -d |
Start services in background |
sail down |
Stop all services |
sail artisan |
Run Artisan commands |
sail composer |
Run Composer commands |
sail npm |
Run NPM commands |
sail test |
Run PHPUnit tests |
sail shell |
Access container shell |
sail mysql |
Connect to MySQL |
sail logs |
View container logs |