version: "3.8"
services:
wordpress:
image: wordpress
container_name: wordpress
ports:
- 8080:80
volumes:
- ./html:/var/www/html
environment:
WORDPRESS_DB_HOST: mysql57
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: 自定义密码
networks:
- web
depends_on:
- mysql57
restart: unless-stopped
mysql57:
image: mysql:5.7
container_name: mysql57
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: 自定义密码
MYSQL_DATABASE: wordpress
networks:
- web
restart: unless-stopped
networks:
web:
name: web
driver: bridge
输入 docker-compose up -d
起洞!