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
I mounted the template in the directory corresponding to the container:
volumes: - "./wp-content/themes:/var/www/html/wp-content/themes"
The problem now is that every time the contents of the template are modified, refreshing the page will not display the modified results, so it is necessary
docker-compose restartI can’t check the revised results until later. Is there something wrong with my configuration?
Version docker for macversion 1.12.0 (build: 10871)
The solution was found, and was not added to the configuration at the earliest time of initialization.
volumesTo mount, if a new mount directory is added later, the original container needs to be deleted and then recreated, as follows:
docker-compose rm wordpress docker-compose up -d