我有以下docker-composer,我尝试调出一个drupal 8站点进行开发,但无法连接到数据库。当我从命令行vendor / drush / drush / drush sql调用时,sql:connect向我显示正确的设置,但仅drupal无法连接到数据库
version: "3"
services:
database:
container_name: database
build:
context: ./docker/database
environment:
- MYSQL_DATABASE=drupal
- MYSQL_USER=user
- MYSQL_PASSWORD=secret
- MYSQL_ROOT_PASSWORD=docker
volumes:
- ./docker/database/data/mysql:/var/lib/mysql
ports:
- "3306:3306"
selenium:
container_name: selenium
build:
context: ./docker/selenium
depends_on:
- nginx
links:
- nginx:dev.timetool.com
volumes:
- /dev/shm:/dev/shm
nginx:
container_name: nginx
build:
context: ./docker/nginx
ports:
- 89:80
- 447:443
links:
- database
restart: always
volumes:
- ./src:/var/www
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/sites/:/etc/nginx/sites-available
- ./docker/nginx/conf.d/:/etc/nginx/conf.d
- ./docker/logs/nginx/:/var/log/nginx/
depends_on:
- php-fpm
php-fpm:
container_name: php-fpm
volumes:
- ./src:/var/www
- ./docker/php-fpm/etc/php.ini:/usr/local/etc/php/conf.d/php.ini
build:
context: ./docker/php-fpm
restart: always
links:
- database
此配置适用于wordpress,laravel,但不适用于drupal。
如何为drupal正确设置docker-compose?