docker真的是个好东西。
version: '3.1' services:
db:
container_name: db
image: mysql/mysql-server
restart: always
networks:
- "blogNet"
environment:
MYSQL_ROOT_PASSWORD: pwd123456
volumes:
- /Docker/mysql/init:/docker-entrypoint-initdb.d
- /Docker/mysql/config/my.cnf:/etc/mysql/my.cnf
- /Docker/mysql/data:/var/lib/mysql wordpress:
container_name: blog
image: wordpress
restart: always
ports:
- :
environment:
WORDPRESS_DB_HOST: db:
WORDPRESS_DB_USER: liudehua
WORDPRESS_DB_PASSWORD: pwd123
networks:
- "blogNet"
volumes:
- /Docker/wordpress/html:/var/www/html
depends_on:
- db
networks:
blogNet:
driver: bridge
docker-compose file