1、编写docker-compose文件
vim docker-compose.yml
version: "3"
services:
db:
image: 10.30.47.120/docker/mysql:5.6
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=123
- MYSQL_DATABASE=wordpress
- MYSQL_USER=tom
- MYSQL_PASSWORD=123
wordpress:
depends_on:
- db
image: 10.30.47.120/docker/wordpress
ports:
- 80:80
environment:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_PORT=3306
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_DB_USER=tom
- WORDPRESS_DB_PASSWORD=123
2、启动docker-compose
docker-compose up -d
3、访问结果,等一段时间,启动比较慢,看日志
docker-compose logs -f