使用 docker-compose 根据 官方教程 配合 wordpress docker 搭起了 wordpress,配置文件如下:
version: '2'
services:
db:
image: mysql:5.6
volumes:
- "./.data/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
links:
- db
ports:
- "8000:80"
volumes:
- "./wp-content/themes:/var/www/html/wp-content/themes"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
我把模板挂载到容器对应的目录里了:
volumes:
- "./wp-content/themes:/var/www/html/wp-content/themes"
现在的问题是,每次修改模板的内容,刷新页面并不会显示修改后的结果,得用 docker-compose restart
后才能查看修改后的结果,请问是不是我哪里配置错了?
版本 docker for mac Version 1.12.0 (build: 10871)
I found a solution. During initialization, the configuration did not add
volumes
for mounting. If a new mounting directory is added later, you need to delete the original container and then recreate it, as follows:Source https://www.digitalocean.com/...