Docker4drupal: Run docker-compose exec within a folder

Created on 16 Nov 2016  路  3Comments  路  Source: wodby/docker4drupal

I'm using https://github.com/drupal-composer/drupal-project to build my Drupal structure and I feel this will become more and more of a standard than the one folder structure that you have now if you download Drupal from drupal.org.

The difference is that you get the vendor folder in the root and then the Drupal stuff is inside /web.

I've adjusted the docker-compose.yml PHP_DOCROOT and NGINX_DOCROOT to web, but when I do docker-compose exec --user 82 php drush it doesn't work because it executes at root level.

I know I can connect on the container, cd into web and then run drush, which works, but I'm more interested how I can run all this from my host machine? Obviously the same problem exists with Console.

help wanted

Most helpful comment

AFAIK, you can specify path to your Docroot via -r option in drush command

All 3 comments

AFAIK, you can specify path to your Docroot via -r option in drush command

More Precisely docker-compose exec --user 82 php drush -r /var/www/html/web cr 5 mins

I opened an issue so we can have that -w--workdir option as if we were using docker exec.
https://github.com/docker/compose/issues/5650

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dcre picture dcre  路  6Comments

LordFransie picture LordFransie  路  3Comments

jayjaydluffy picture jayjaydluffy  路  5Comments

rsanzante picture rsanzante  路  7Comments

arrubiu picture arrubiu  路  4Comments