Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
two wordpress sites, nginx-proxy, mariadb, and phpmyadmin. uses official WordPress container from hub.docker.com
version: "2"
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
db:
image: mariadb
volumes:
- mysql:/var/lib/mysql
ports:
- "8001:3306"
environment:
- MYSQL_ROOT_PASSWORD=secret
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- "8002:80"
links:
- db:mysql
environment:
- MYSQL_ROOT_PASSWORD=secret
- VIRTUAL_HOST=phpmyadmin.app
- VIRTUAL_PORT=8002
wp1:
image: wordpress
volumes:
- ./wp1:/var/www/html
ports:
- "8003:80"
links:
- db:mysql
environment:
- WORDPRESS_DB_NAME=wp1
- WORDPRESS_DB_PASSWORD=secret
- VIRTUAL_HOST=wp1.dev
- VIRTUAL_PORT=8003
wp2:
image: wordpress
volumes:
- ./wp2:/var/www/html
ports:
- "8004:80"
links:
- db:mysql
environment:
- WORDPRESS_DB_NAME=wp2
- WORDPRESS_DB_PASSWORD=secret
- VIRTUAL_HOST=wp2.dev
- VIRTUAL_PORT=8004
volumes:
mysql:
Owner

jimfrenette commented Mar 12, 2017

hosts

# Docker (nginx-proxy)
127.0.0.1	wp1.dev
127.0.0.1	wp2.dev
127.0.0.1	phpmyadmin.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment