1
drush 2020-02-04 12:07:13 +08:00 1
drush pm-uninstall recaptcha
|
2
drush 2020-02-04 12:09:49 +08:00
而且其实可以用 drush uli 去 login 后台
|
3
mafeifan 2020-02-04 18:05:36 +08:00
哈哈,楼上这头像配这回复真绝了
|
4
programV2 OP @drush 谢谢大佬! 请问要如何在 docker 容器安装 drush? 网上找不到文档, 用 stackoverflow 之前有人分享的方法老是安装出错, 求大佬指教. 谢谢 !
把 drush 安装在 drupal 容器内: $ docker exec -ti <MY_DRUPAL_CONTAINER> \ bash -c 'php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" \ > drush && chmod +x drush && mv drush /usr/local/bin' 执行上面那个命令 得到的错误如下: OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown |
5
programV2 OP @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 |
6
programV2 OP @mafeifan
@drush 我根据上一条报错信息修改 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:/usr/local/bin" - "./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 container_name: "${PROJECT_NAME}_drush" volumes: - "./drupal/drush:/usr/local/bin" 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 报错信息如下 Creating drupal8_mysql ... Creating drupal8_drush ... error ERROR: for drupal8_drush Cannot start service drush: OCI runtime create failed: container_linux. Creating drupal8_mysql ... done unknown Creating drupal8_drupal ... error ERROR: for drupal8_drupal Cannot start service php: OCI runtime create failed: container_linux.g o:345: starting container process caused "exec: \"docker-php-entrypoint\": executable file not fo und in $PATH": unknown ERROR: for php Cannot start service php: OCI runtime create failed: container_linux.go:345: star ting container process caused "exec: \"docker-php-entrypoint\": executable file not found in $PAT H": unknown ERROR: for drush Cannot start service drush: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"drush\": executable file not found in $PATH": unknown ERROR: Encountered errors while bringing up the project. |
7
drush 2020-02-04 22:28:55 +08:00
嗯。。其实我觉得不用太复习,你在 drupal 那个 docker container 里,composer require drush/drush 然后那里面那个 drush.phar 跑就行了
|
8
drush 2020-02-04 22:34:09 +08:00
若果非要用 docker 装 drush 的话,可以试下 base 这个 php image https://github.com/wodby/drupal-php/blob/master/7/Dockerfile
|
9
programV2 OP @drush 谢谢大佬的回复! 我想访问 drupal 容器直接报错 ;
$docker-compose exec php bash OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown 用 docker-compose ps 查看如下 : drupal8_drupal docker-php-entrypoint php-fpm Up drupal8_mysql /entrypoint.sh --default-a ... Restarting drupal8_nginx nginx -g daemon off; Up 另外不知道为什么 mysql 一直在 restarting? 大佬您看我这个 docker-compose.yml 有问题吗? 为了让 drush 能访问 mysql, 我把 mysql 的 volumes 也复制到 drupal 容器 # 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/mysql/mysql:/var/lib/mysql" - "./drupal/mysql/bin:/usr/bin" - "./drupal/web:/var/www/html" restart: always depends_on: - mysql 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 |
10
programV2 OP @drush V 友你好, 我执行 composer require drush/drush 后显示 没有 composer 这个命令, 然后我用以下代码手动安装:
php -r "readfile('http://files.drush.org/drush.phar');" > drush && chmod +x drush && mv drush /usr/bin/ 但是执行# /usr/local/bin/drush uli 报错: /usr/local/bin/drush: line 2: syntax error: unexpected "(" 请问还有什么办法安装上drush吗? 谢谢! |