version: '1'
services:
mysql:
image: mysql:5.6
restart: always
volumes:
- "./data:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: password
expose:
- "3306"
wordpress:
image: wordpress:latest
restart: always
depends_on:
- mysql
links:
- mysql
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpress
ports:
- "80:80"
Q.E.D.