Docker Compose for Symfony + MariaDB + RabbitMQ + Mailpit
Symfony is a mature PHP framework built for performance and reliability. Its component architecture powers many major projects including Drupal and Shopware, making it a common choice for APIs, e-commerce platforms, and complex business applications.
MariaDB 11 is a high-performance, MySQL-compatible database developed by the original MySQL authors. It offers additional storage engines and an improved query optimizer, and is a popular drop-in replacement in European production environments.
RabbitMQ is a reliable AMQP message broker for decoupling services and handling async workloads. Symfony Messenger and Laravel Queues both support RabbitMQ natively via the AMQP transport.
When should you use this stack?
Symfony with MariaDB and RabbitMQ is a solid default for local development when your production environment matches it. If you're evaluating alternatives, the related configurations below swap one piece at a time — same framework with a different database, or the same data layer under a different framework — so you can compare without starting from scratch.
docker compose up -d
http://localhost:8080
http://localhost:8025
compose.yml
services:
nginx:
image: nginx:latest
ports:
- "${WEB_PORT-8080}:80"
volumes:
- .:/var/www/html
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php
php:
image: php:8.5-fpm
volumes:
- .:/var/www/html
mariadb:
image: mariadb:11
environment:
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD-root}
MARIADB_DATABASE: ${MARIADB_DATABASE-app}
MARIADB_USER: ${MARIADB_USER-app}
MARIADB_PASSWORD: ${MARIADB_PASSWORD-secret}
ports:
- "${MARIADB_PORT-3306}:3306"
volumes:
- mariadb_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
rabbitmq:
image: rabbitmq:3-management
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER-app}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS-secret}
ports:
- "${RABBITMQ_PORT-5672}:5672"
- "${RABBITMQ_MANAGEMENT_PORT-15672}:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s
timeout: 5s
retries: 5
mailpit:
image: axllent/mailpit
ports:
- "${MAILPIT_SMTP_PORT-1025}:1025"
- "${MAILPIT_UI_PORT-8025}:8025"
volumes:
mariadb_data:
docker/nginx/default.conf
Run mkdir -p docker/nginx first
server {
listen 80;
server_name localhost;
root /var/www/html/public;
index index.php index.html;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
.env.example
Optional — Compose uses ${VAR-default} fallbacks
WEB_PORT=8080 MARIADB_PORT=3306 MARIADB_DATABASE=app MARIADB_USER=app MARIADB_PASSWORD=secret RABBITMQ_PORT=5672 RABBITMQ_MANAGEMENT_PORT=15672 RABBITMQ_DEFAULT_USER=app RABBITMQ_DEFAULT_PASS=secret MAILPIT_SMTP_PORT=1025 MAILPIT_UI_PORT=8025