How to use docker with drupal and drush?

前端 未结 8 1677
日久生厌
日久生厌 2021-01-30 23:40

I\'d like to use drush. It needs to run in the drupal container. There\'s also a drush docker repo. But I have no clue how to make it available whithin the drupal container. It\

8条回答
  •  星月不相逢
    2021-01-31 00:22

    One of the solutions for Drupal 8 - Docker - Drush combo is:

    1. Step: Installing the Drush in the image where you have the Apache server, let's call this docker image 'php5'.
    2. Step: make an alias in your ~/.bashrc file like this:

      alias dr5='docker-compose run php5 /root/.composer/vendor/bin/drush --root=/var/www/html/docroot';
      

    In this alias i use the Docker composer but it is the same with simple Docker, you runt the Drush command on the php5 image specifying where your drush is in Docker and where your codebase is on Docker. In this way you just use it like this:

    dr5 cr
    

    For the cache rebuild command, in you local code directory.

提交回复
热议问题