WordPress的docker-compose.yml
时间: 2024-03-25 22:37:19 浏览: 70
以下是一个基本的WordPress的docker-compose.yml文件示例:
```
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: your_mysql_root_password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress_password
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress_password
WORDPRESS_DB_NAME: wordpress
volumes:
- ./wp-content:/var/www/html/wp-content
volumes:
db_data:
```
其中,db是使用MySQL 5.7的数据库服务,WordPress使用最新的WordPress镜像,并将本地的wp-content目录映射到容器中。数据库和WordPress服务都有自己的环境变量配置。
阅读全文