wordpress 官方 docker,为什么编辑文件无法自动同步到 container 里
阿神
阿神 2017-04-24 16:00:48
0
1
561

使用 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)

阿神
阿神

闭关修行中......

reply all(1)
Ty80

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:

docker-compose rm wordpress
docker-compose up -d

Source https://www.digitalocean.com/...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template