Laravel MySQL Redis Docker Compose
Copy a ready-to-run Laravel + MySQL + Redis docker-compose.yml for local development. Includes .env.example, commands, and connection strings — no signup.
Laravel + MySQL + Redis
Copy a ready-to-run Laravel + MySQL + Redis docker-compose.yml for local development. Includes .env.example, commands, and connection strings — no signup.
This tool runs locally in your browser. Your input is not uploaded.
Copy the generated result or open the full tool to adjust inputs locally.
Laravel + MySQL + Redis
services:
app:
image: "laravelsail/php82-composer:latest"
command: "php artisan serve --host=0.0.0.0 --port=8000"
env_file:
- .env
ports:
- "8000:8000"
depends_on:
- db
volumes:
- ".:/app"
working_dir: /app
networks:
- app_network
db:
image: "mysql:8.4"
environment:
MYSQL_DATABASE: "${MYSQL_DATABASE}"
MYSQL_USER: "${MYSQL_USER}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
ports:
- "3306:3306"
volumes:
- "mysql_data:/var/lib/mysql"
healthcheck:
test:
- CMD-SHELL
- "mysqladmin ping -h localhost -u${MYSQL_USER} -p${MYSQL_PASSWORD}"
interval: "10s"
timeout: "5s"
retries: 5
networks:
- app_network
redis:
image: "redis:7-alpine"
ports:
- "6379:6379"
volumes:
- "redis_data:/data"
healthcheck:
test:
- CMD-SHELL
- redis-cli ping
interval: "10s"
timeout: "5s"
retries: 5
networks:
- app_network
volumes:
mysql_data: {}
redis_data: {}
networks:
app_network:
driver: bridge
# .env.example
COMPOSE_PROJECT_NAME=laravel_app
APP_PORT=8000
APP_ENV=development
APP_SECRET=change-me
MYSQL_DATABASE=app
MYSQL_USER=app
MYSQL_PASSWORD=change-me
MYSQL_ROOT_PASSWORD=change-me-root
DATABASE_URL=mysql://app:change-me@db:3306/app
DATABASE_PORT=3306
REDIS_URL=redis://redis:6379/0
REDIS_PORT=6379
# Commands
cp .env.example .env
docker compose up -d --build
docker compose ps
docker compose logs -f app
docker compose exec app sh
docker compose down
docker compose down -v # remove named volumes and local data
# Notes
MySQL internal: mysql://app:${MYSQL_PASSWORD}@db:3306/app
MySQL local: mysql://app:${MYSQL_PASSWORD}@localhost:${DATABASE_PORT}/app
Redis internal: redis://redis:6379/0
Redis local: redis://localhost:${REDIS_PORT}/0
Preset: Laravel + MySQL + Redis
Mode: development
Notes:
- Review image tags, commands, and mounted paths for your actual application layout.
- Secrets are represented as environment variables in .env.example; replace placeholder values before use.
- Healthchecks are included for supported infrastructure services.
- Named Docker volumes are enabled for local persistence.Copy a ready-to-run Laravel + MySQL + Redis docker-compose.yml for local development. Includes .env.example, commands, and connection strings — no signup.
Laravel + MySQL + Redis
It is a strong starter, not a hardened production deployment. Review secrets, TLS, backups, resource limits, and network exposure before production use.
No. Preset generation is static and the interactive builder runs locally in the browser.
Yes. The page exposes copyable and downloadable output for docker-compose.yml and related notes.