SMSOFTWARE

🐳 Laravel API — Docker Compose Command Sheet

This command list is for the non-Sail Docker workflow, using these services:

app → Laravel (PHP-FPM)

laravel_db → Database

laravel_worker → Queue worker

I. 🚀 Daily Workflow (Start / Stop)
Action Command Notes
Start environment docker compose up -d Starts all containers in background
Clear config cache docker compose exec app php artisan config:clear Required after every fresh up -d to reload .env and APP_KEY
Stop environment docker compose down Stops containers but keeps database data
Restart containers docker compose restart Fast restart without container removal
II. 🛠️ One-Time Setup (Run Once Per Project)

Run these commands only once, inside the app container.

Action Command Purpose
Install dependencies docker compose exec app composer install Installs vendor/
Generate app key docker compose exec app php artisan key:generate Writes APP_KEY to .env
Run migrations docker compose exec app php artisan migrate Creates database tables
Reset everything docker compose down -v ⚠️ Deletes all containers AND database data
III. ⚙️ Laravel Artisan & Development Commands
Action Command
Run any Artisan command docker compose exec app php artisan <command>
Open Tinker docker compose exec app php artisan tinker
Run tests docker compose exec app php artisan test
View worker logs docker compose logs laravel_worker
Open shell (bash) docker compose exec app bash
🌐 Access Points
Service URL
Application (Nginx) http://localhost or http://192.168.1.6
PHPMyAdmin http://localhost:8080
✅ Notes & Best Practices

Do not install PHP, Apache, or MySQL on Windows

Always clear config cache after container startup

Use down -v only when you intentionally want a fresh database

This setup matches production architecture (Nginx + PHP-FPM)

6 days ago | [YT] | 2