docker_practice/compose/wordpress.md

52 lines
1.4 KiB
Go
Raw Normal View History

# 使 WordPress
2016-11-25 22:24:48 +08:00
2019-03-08 12:21:07 +08:00
> `PHP`
2015-01-14 14:09:38 +08:00
2017-11-26 09:54:04 +08:00
`Compose` 便 `Wordpress`
2017-11-01 00:20:30 +08:00
##
2015-01-14 14:09:38 +08:00
2017-11-23 15:48:52 +08:00
`wordpress`
2015-01-14 14:09:38 +08:00
## `docker-compose.yml`
2015-01-14 14:09:38 +08:00
[`docker-compose.yml`](https://github.com/yeasy/docker_practice/blob/master/compose/demo/wordpress/docker-compose.yml) 文件将开启一个 `wordpress` 服务和一个独立的 `MySQL` 实例:
2015-01-14 14:09:38 +08:00
2017-11-01 00:20:30 +08:00
```yaml
version: "3"
services:
2017-11-23 15:48:52 +08:00
db:
image: mysql:8.0
command:
- --default_authentication_plugin=mysql_native_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
2017-11-23 15:48:52 +08:00
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
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
volumes:
db_data:
2015-01-14 14:09:38 +08:00
```
##
2015-01-14 14:09:38 +08:00
2017-11-26 09:54:04 +08:00
`docker-compose up -d` Compose `wordpress` 访 `127.0.0.1:8000` `WordPress`