Docker compose configuration and images for local development. Originally built for Magento 2 / Adobe Commerce, but usable for other PHP projects. Tested on Ubuntu 22.04.
- Docker Engine + Compose plugin
- mkcert (installed by
./bin/init.sh) - Linux (Windows/macOS may work with manual adjustments)
- Make scripts executable:
chmod +x ./bin/init.sh ./bin/add-domain.sh
- Install mkcert and generate local certs (run as your normal user):
./bin/init.sh
- Start containers:
docker compose up -d
- Open
https://example.localhost
Optional: add a custom domain with HTTPS:
./bin/add-domain.sh appname.localhost
- Installs
mkcertandlibnss3-tools - Trusts the mkcert local CA for the current user
- Generates
conf/ssl/dev.pemandconf/ssl/dev-key.pemforlocalhost,*.localhost, and*.dev.localhost
Note: Do not run ./bin/init.sh with sudo. If you did, re-run mkcert -install as your normal user.
conf/ssl/dev.pemandconf/ssl/dev-key.pemare mounted into nginx as/etc/nginx/ssl/dev.pemand/etc/nginx/ssl/dev-key.pem.- Nginx includes them via
conf/nginx/snippets/ssl.conf. - To use the default dev certificate in your vhost, add IPv6 listeners (required for dual-stack):
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
include /etc/nginx/snippets/ssl.conf;
- Put your app under
www/your-app - Use a domain ending in
.dev.localhost(e.g.reisebank.dev.localhost) - Add an nginx vhost in
conf/nginx/conf.d/(useconf/nginx/conf.d/example.confas a template) - Restart nginx:
docker compose restart nginx
No host entry or certificate generation is needed for .dev.localhost domains.
- Put your app under
www/your-app - Add a host entry for non-
.localhostdomains (Linux example):
127.0.0.1 your-app.localhost
- Run:
./bin/add-domain.sh appname.test - Add an nginx vhost in
conf/nginx/conf.d/ - Restart nginx
- nginx:
80,443 - MariaDB:
3306 - phpMyAdmin:
8080 - Redis: internal only
- RabbitMQ Management:
8082 - Elasticsearch 7:
9201 - OpenSearch:
9200,9300
- Host:
mysql - User:
admin(password fromdocker-compose.yml) - Root:
root(password fromdocker-compose.yml)
If you need database creation privileges for admin, use root to grant them.
Start:
docker compose up -d
Stop:
docker compose down
Restart nginx:
docker compose restart nginx
If the browser shows an untrusted cert warning:
mkcert -install
mkcert -cert-file conf/ssl/dev.pem -key-file conf/ssl/dev-key.pem example.localhost localhost "*.localhost"
docker compose restart nginx
Then fully restart the browser.