version: '3.1'
services:
wordpress:
image: wordpress
restart: always
networks:
mynet1:
ipv4_address: 172.21.0.2
ports:
- 8080:80
volumes:
- ~/docker/wordpress/html:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: mypassword
WORDPRESS_DB_NAME: wordpress
db:
image: mysql:5.7
restart: always
volumes:
- db:/var/lib/mysql
ports:
- 3306:3306
networks:
mynet1:
ipv4_address: 172.21.0.3
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: mypassword
MYSQL_RANDOM_ROOT_PASSWORD: '1'
phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
- db
links:
- db:mysql
ports:
- 8181:80
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: '1'
networks:
mynet1:
ipv4_address: 172.21.0.4
volumes:
html:
db:
networks:
mynet1:
ipam:
config:
- subnet: 172.21.0.0/16