Docker4drupal: Drupal console not available

Created on 13 Oct 2016  路  16Comments  路  Source: wodby/docker4drupal

Drupal console is not installed. Whenever I try to run it I get:

[ERROR] Drupal Console is not installed at: /var/www/html/
You must execute this composer command:

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader

bug

Most helpful comment

I don't see a problem actually. The php container has a global installation of Drupal Console, just follow the instructions you get when you're using it.

Example:

docker run -ti wodby/drupal-php:7.0

Now you're in the container, the global DC installation is in your path, just missing some settings. Create them using

drupal init --override --no-interaction

Next step: download Drupal, e.g. using Drush:

drush dl drupal
cd drupal-8.2.1

Now, if you use DC, it tells you about the missing local installation. Add it, using Composer:

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
composer update drupal/console --with-dependencies

Now there's a working local installation in your Drupal root, without having to add paths or anything else. Just use it:

drupal about

Or am I missing something?

All 16 comments

@wilfredwaltman I've rebuilt php containers, Drupal Console installed globally and initialized under www-data user.

Hmmm, thanks for that quick response. I pulled the new docker images but stil get the same errors. Start to think it is something I do wrong.

But when I do docker-compose exec php sh en call "drupal" in that shell, or I do docker-compose exec --user 82 php drupal list, I still get the same messages.

I was kind of expecting "drupal" to work just like the "drush" and "composer" command, which work fine.

Could you share an output of the following commands:

  • docker-compose pull
  • docker-compose exec --user=82 php id
  • docker-compose exec --user=82 php ls -la /usr/local/bin

afaik, the latest versions of Drupal Console need to be installed as project dependency, not globally: https://github.com/hechoendrupal/DrupalConsole#download-as-new-dependency. The mentioned error shows that in fact it is installed globally, otherwise you wouldn't get this message. Just add it 'locally' to the project using composer require!

Source: https://twitter.com/drupalconsole/status/778602266341191681

docker-compose pull
Pulling php (wodby/drupal-php:7.0)...
7.0: Pulling from wodby/drupal-php
214982d464b2: Already exists
14b376b33233: Pull complete
6b00500974ab: Pull complete
fb8fa6417cd9: Pull complete
dd8a17611d7b: Pull complete
425c53a15ff1: Pull complete
756acd9a4b35: Pull complete
58ef271d7752: Pull complete
efaff637f350: Pull complete
9f42697fe2b0: Pull complete
b40326f17595: Pull complete
e2ac1ddb0ed1: Pull complete
Digest: sha256:13e47b9d3149f26a0c4d108b86dae1ab524ac2ee15d90e81dfb3c45208d0ccd2
Status: Downloaded newer image for wodby/drupal-php:7.0
Pulling phantomjs (shufo/phantomjs:latest)...
latest: Pulling from shufo/phantomjs
d0ca440e8637: Already exists
2bb3cded8def: Already exists
Digest: sha256:e875bbe1aeb4a21363a78a20bbc1ec932c426c78fd5e2bd2374fb8bdcf153077
Status: Image is up to date for shufo/phantomjs:latest
Pulling nginx (wodby/drupal-nginx:latest)...
latest: Pulling from wodby/drupal-nginx
c0cb142e4345: Already exists
1a1fabde57d8: Pull complete
71d71572dd8e: Pull complete
1d8c62fe0495: Pull complete
75073c466db7: Pull complete
c7755c28932d: Pull complete
1b70cfe83245: Pull complete
171d29f01b6b: Pull complete
6fe00050d418: Pull complete
Digest: sha256:b95dd88089ca142e128c36496f3c7849928a0925e99bbc30775910ef35676051
Status: Downloaded newer image for wodby/drupal-nginx:latest
Pulling pma (phpmyadmin/phpmyadmin:latest)...
latest: Pulling from phpmyadmin/phpmyadmin
c0cb142e4345: Already exists
c21ab316f7a0: Pull complete
bfce1918eaca: Pull complete
30e078889fd4: Pull complete
302ef4dfe91d: Pull complete
0e9a6c95e13b: Pull complete
7428aacafdc3: Pull complete
Digest: sha256:24b0d808e71ec8a05fa2a569f18e5770b680ad0fe79195eb37f087448a725554
Status: Downloaded newer image for phpmyadmin/phpmyadmin:latest
Pulling mailhog (mailhog/mailhog:latest)...
latest: Pulling from mailhog/mailhog
Digest: sha256:ef74ed4c95466d4cbbd2c88d50f4050561383d5c4c50dfc53b96b2db767b309f
Status: Image is up to date for mailhog/mailhog:latest
Pulling mariadb (wodby/drupal-mariadb:latest)...
latest: Pulling from wodby/drupal-mariadb
Digest: sha256:62ebf6b03dda83c0504b278b3d53a059484346b984f63889bac19dbe65117240
Status: Image is up to date for wodby/drupal-mariadb:latest

docker-compose exec --user=82 php id
uid=82(www-data) gid=82(www-data) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)

docker-compose exec --user=82 php ls -la /usr/local/bin
total 7932
drwxr-xr-x 3 root root 4096 Oct 14 12:47 .
drwxr-xr-x 10 root root 4096 Oct 14 12:47 ..
-rwxr-xr-x 1 root root 1704783 Oct 14 03:59 composer
drwxr-xr-x 2 root root 4096 Oct 14 12:47 console
-rwxr-xr-x 1 root root 805 Oct 14 03:59 docker-entrypoint.sh
-rwxr-xr-x 1 root root 525281 Oct 14 03:59 drupal
-rwxr-xr-x 1 root root 5867782 Oct 14 03:59 drush

@drubb It looks like we should remove Drupal Console from the drupal-php image, because user should care about it by yourself.

I'd leave it as it is. The advantage of a global installation is that it's easier to add it to the path. If Drupal Console works like Drush, a global installation will pass control to a local instance, if one is discovered. Also, the user is asked to install a local instance, as above.

I've made some tests and It looks like Drupal Console doesn't work globally, so I suggest to remove it.

Another issue, there is no way (or I don't know how) to add ~/.composer/vendor/bin to $PATH in alpine. The modification of ~/.profile or ~/.shrc does not work. So, you should specify a full path ~/.composer/vendor/bin/drupal each time you want to call drupal for example.

@andypost yes, it works but only if you logged in with sh --login flag, otherwise /etc/profile won't be loaded. It isn't usable for end users. It's possible to change entry point by ["/bin/sh", "--login"], but I actually don't know about potential side effects.

@PavelPrischepa I prefer using ash --login so looks this loads profile everytime, no side effects found.

About _console_ - with d8.2 I can make it run only when it installed locally, so no more using it as global

I don't see a problem actually. The php container has a global installation of Drupal Console, just follow the instructions you get when you're using it.

Example:

docker run -ti wodby/drupal-php:7.0

Now you're in the container, the global DC installation is in your path, just missing some settings. Create them using

drupal init --override --no-interaction

Next step: download Drupal, e.g. using Drush:

drush dl drupal
cd drupal-8.2.1

Now, if you use DC, it tells you about the missing local installation. Add it, using Composer:

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
composer update drupal/console --with-dependencies

Now there's a working local installation in your Drupal root, without having to add paths or anything else. Just use it:

drupal about

Or am I missing something?

@drubb it looks Okay for me.
@wilfredwaltman have you still any questions or issues?

@PavelPrischepa I got it working now. Couldn't at first because symfony/dom-crawler:3.1.4 was blocking it.
Once I got it down to 2.8.* I was able to install the Drupal Console. It's terribly slow in my installation but it's working. I will try this soon in a fresh install.

Thanks for checking and all the effort.

Ok, I'm going to close the issue.

Drupal Console display
[ERROR] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristianNally picture ChristianNally  路  8Comments

andrewhorokhovets picture andrewhorokhovets  路  8Comments

suricactus picture suricactus  路  9Comments

AminSarafraz picture AminSarafraz  路  4Comments

pulasthibandara picture pulasthibandara  路  6Comments