我有一个要容器化的网站,我尝试按照此link中提到的步骤进行操作
我已将文件复制到/var/www/html/example.com/src/,而且我的docker-compose文件看起来像这样:
version: '2'
services:
example_db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: ${WP_DB_USER_PASSWORD}
MYSQL_DATABASE: ${WP_DB_NAME}
volumes:
- /var/lib/mysql:/docker-entrypoint-initdb.d/example.sql
container_name: example_db
restart: always
example:
depends_on:
- example_db
image: wordpress:5.0.0-php5.6-apache # we're using the image with php7.1
environment:
WORDPRESS_DB_PASSWORD: ${WP_DB_USER_PASSWORD}
WORDPRESS_DB_NAME: ${WP_DB_NAME}
container_name: example
ports:
- "1512:80"
restart: always
links:
- example_db:mysql
volumes:
- ./src:/var/www/html/docker/example.com/src/
我在/www/html/docker/example.com/src/中有我的wordpress文件,在/src/docker/example.com/data/docker-entrypoint-initdb.d/lbdocker.sql < / p>
每次访问该网站时,它都会访问WordPress设置指南。