I have set up a local dev docker environment with the Drupal social distribution. My issue is that Drush commands do not work and whenever I run a Drush command, it takes approximately 45 seconds to get a response. Generally, the output is always the same or similar to the following.

[warning] proc_open(): unable to dup File-Handle for descriptor 2 - Too many open files exec.inc:243
[warning] proc_get_status() expects parameter 1 to be resource, boolean given exec.inc:244
[warning] proc_close() expects parameter 1 to be resource, boolean given exec.inc:245

I am unsure what the reason for this response is or what I may have done wrong to get to this point. I tried googling the warning errors but without getting a usable answer. If someone has had similar problems and managed to solve it, some directions on what to do would be appreciated.

I also want to state that outside the docker environment I have setup multiple Drush setups; Drush commands work normally without any delay outside of it.

My environment is Ubuntu 16.04 with 15.5 GB RAM, i7-6500U CPU 2.5 GHz x4 Processor, 200GB DDR disk.

I googled some more and found out that for running Drush inside a docker environment you need docker-compose run drush "drush command here" since Drush container gets run only for one specific command and then shuts back down, but now I am getting different errors.

docker-compose run drush cache-rebuild --verbose --debug gives this as output.

Phar detected. Proceeding to drush_main().Drush preflight prepare loaded autoloader at [0 sec, 2.92 MB] [preflight]
Starting Drush preflight. [0 sec, 2.92 MB] [preflight]
Cache HIT cid: 8.1.2-commandfiles-0-9c75c37463d39480ab97163ab2be3712 [0.01 sec, 2.96 MB] [debug]
Scanning into /etc/drush for /.*aliases.drush(8|)rc.php$/ [0.02 sec, 5.02 MB] [debug]
Scanning into /etc/drush for /self.alias.drush(8|)rc.php$/ [0.02 sec, 5.02 MB] [debug]
Scanning into phar:///usr/local/bin/drush/includes/.. for /.*aliases.drush(8|)rc.php$/ [debug] [0.02 sec, 5.02 MB]
Scanning into phar:///usr/local/bin/drush/includes/.. for /self.alias.drush(8|)rc.php$/ [debug] [0.03 sec, 5.03 MB]
Scanning into /root/.drush for /.*aliases.drush(8|)rc.php$/ [0.04 sec, 5.03 MB] [debug]
Scanning into /root/.drush for /self.alias.drush(8|)rc.php$/ [0.04 sec, 5.03 MB] [debug]
Bootstrap to phase 0. [0.05 sec, 6.01 MB] [bootstrap]
Bootstrap to phase 2. [0.05 sec, 6.01 MB] [bootstrap]
Command cache-rebuild needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error] [0.05 sec, 6.01 MB]
Command cache-rebuild requires Drupal core version 8+ to run. [0.05 sec, 6.01 MB] [error]
The drush command 'cache-rebuild' could not be executed. [0.05 sec, 6.01 MB]

Hope that gives you a clue of what is the matter here.

closed as too broad by kiamlaluno Jul 19 at 4:55

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Can you run your drush command with --verbose --debug and add the entire command log here? (omit sensitive strings of course) – Joseph Jul 4 '17 at 14:09
  • i have very similar machine, I installed lamp and from terminal installed drush 8.1.8, and i have no issues at all – pinueve Jul 4 '17 at 21:28
  • As I updated my question when discovering that drush need to be run in a different fashion inside docker, the problem persists of me not being able to resolve and drush commands and as @Joseph the Dreamer mentioned I tried to add verbose and debug to the command and am going to post the output into my question as new update. – user3320816 Jul 5 '17 at 8:27
  • Looks like you also use docker-compose. Can you post the docker-compose.yml? Also, post your alias file, if any. – Joseph Jul 5 '17 at 12:26

When you run docker run ... or docker-compose run, Drush is running in the context of the container, not your host machine. So when it needs stuff like DB credentials, aliases, ssh keys, it looks for them in the container. If Drush cannot find such things in the container, Drupal cannot fully connect to Drupal and you get an error, usually the bootstrapping one.

I have a feeling your code isn't mounted to the Drush container, based on the fact that the alias scanning isn't picking up anything custom, only the usual alias paths. If the code is mounted, then probably the Drush container does not have the DB credentials. Do a drush status to check if everything is fine.

Not the answer you're looking for? Browse other questions tagged or ask your own question.