我无法弄清楚docker compose的第2版。 一切都与版本1完美配合,但它现在似乎忽略了数据库的volumes_from,每当我启动它,重建之后,db已经有一个数据库从不同的容器中运行,所以它不是使用下面的sql-data中指定的卷位置?
version: '2'
services:
apache:
container_name: "quotationspro_fix_apache_1"
build: ./images/apache/
ports:
- "80:80"
- "443:443"
volumes_from:
- application
php-fpm:
container_name: "quotationspro_fix_phpfpm_1"
build: ./images/php-fpm-7.0/
expose:
- 9000
volumes_from:
- application
sql-server:
container_name: "quotationspro_fix_sql_1"
image: mariadb:10.1
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE:
MYSQL_USER:
MYSQL_PASSWORD:
volumes_from:
- sql-data
ports:
- "3306:3306"
expose:
- 3306
sql-data:
container_name: "quotationspro_fix_sqldata_1"
image: mariadb:10.1
volumes:
- ./database/fix:/var/lib/mysql/data
application:
container_name: "quotationspro_fix_app_1"
image: php:7.0-fpm
volumes:
- ../www:/var/www/html
- ./images/app/fix-settings.inc.php:/var/www/html/config/settings.inc.php
command: "true"
phpmyadmin:
container_name: "quotationspro_fix_phpmyadmin_1"
image: phpmyadmin/phpmyadmin
ports:
- "8080:80"
environment:
PMA_HOST: "sql-server"
PMA_POST: "3306"