@
mafeifan @
programV2 然后我尝试使用 docker-compose.yml 建一个 drush 容器并把它挂载到 drupal 容器上,又碰到报错信息:
Pulling drush (drush/drush:)...
latest: Pulling from drush/drush
c87736221ed0: Pull complete
bcb58026c06e: Pull complete
6c24eee1bf47: Pull complete
864f09cef0fe: Pull complete
9107aebea488: Pull complete
e674e7b6cfae: Pull complete
fc2489165087: Pull complete
0b45d6fb692c: Pull complete
1452b3ed7eef: Pull complete
3e9c078fa313: Pull complete
6efeada2aeab: Pull complete
5f493cb151ef: Pull complete
656e2628aadc: Pull complete
31ccf03e7a0c: Pull complete
c31dbcded259: Pull complete
f33ad91f829f: Pull complete
dcfca166b834: Pull complete
ef7668c04a97: Pull complete
616dff10d9a8: Pull complete
71e8edf7fb7f: Pull complete
Digest: sha256:cb26e96449bdbf2fe34f016a19d74957017f1332093bc6b7f20a7b835f5da682
Status: Downloaded newer image for drush/drush:latest
Creating drupal8_mysql ...
Creating drupal8_drush_1 ... error
ERROR: for drupal8_drush_1 Cannot start service drush: OCI runtime create faile d: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/root/drupal8/drupal/drush/drush\\\" to rootfs \\\"/var/lib/docker/overlay2/3d4c873a30ff0fdf5ad7805 43789f1ccbf7e5d5046ca91dbe9928fecec954044/merged\\\" at \\\"/var/lib/docker/over lay2/3d4c873a30ff0fdf5ad780543789f1ccbf7e5d5046ca91dbe9928fecec954044/merged/usr/local/bin/drush\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying
Creating drupal8_mysql ... done
th exists and is the expected type
Creating drupal8_drupal ... done
Creating drupal8_nginx ... done
ERROR: for drush Cannot start service drush: OCI runtime create failed: contain er_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/root/drupal8/drupal/drush/drush\\\" to rootfs \\\"/var/lib/docker/overlay2/3d4c873a30ff0fdf5ad780543789f1ccb f7e5d5046ca91dbe9928fecec954044/merged\\\" at \\\"/var/lib/docker/overlay2/3d4c8 73a30ff0fdf5ad780543789f1ccbf7e5d5046ca91dbe9928fecec954044/merged/usr/local/bin /drush\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.
我的 docker-compose.yml 内容如下:
# docker-compose.yml
version: "3"
services:
web:
image: nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
ports:
- $NGINX_PORTA
- $NGINX_PORTB
volumes:
- "./drupal/web:/var/www/html"
- "./drupal/logs/nginx:/var/log/nginx"
- "./drupal/nginx.conf:/etc/nginx/conf.d/default.conf"
- "./drupal/cloudflare:/etc/ssl"
depends_on:
- php
php:
image: drupal:$DRUPAL_TAG
container_name: "${PROJECT_NAME}_drupal"
volumes:
- "./drupal/drush/drush:/usr/local/bin/drush"
- "./drupal/drush/composer:/usr/local/bin/composer"
- "./drupal/mysql/mysql:/var/lib/mysql"
- "./drupal/mysql/bin:/usr/bin"
- "./drupal/web:/var/www/html"
restart: always
depends_on:
- mysql
drush:
image: drush/drush
volumes:
- "./drupal/drush/drush:/usr/local/bin/drush"
- "./drupal/drush/composer:/usr/local/bin/composer"
mysql:
image: mysql:$MYSQL_TAG
container_name: "${PROJECT_NAME}_mysql"
entrypoint: ['/
entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
environment:
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
MYSQL_DATABASE: $DB_NAME
volumes:
- "./drupal/mysql/mysql:/var/lib/mysql"
- "./drupal/mysql/bin:/usr/bin"
restart: always