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\
In order to make Drush work effectively - you're better off running it from within the container that is running Drupal. For that, add a one liner in your Dockerfile.
# Set base Image/tag here.
FROM drupal:8-fpm
# Get a global installation of Drush on the web / drupal container
RUN php -r "readfile('http://files.drush.org/drush.phar');" > drush && chmod +x drush && mv drush /usr/bin/
For actual usage, you're better off shipping separate Drush aliases for usage - both from the container and the host (via public key SSH). As an example, look at these aliases and consider the entire setup as a reference implementation: https://github.com/srijanaravali/docker-blueprint/blob/master/docker-utils/drush/local.aliases.drushrc.php
You can transport these aliases into the container by having something like this in your Dockerfile:
# Push our aliases into the container ~/.drush
ADD /path/to/your/drush-aliases/* ~/.drush/
or - for shared control with the host, you can consider having it mounted as a volume in your docker-compose.yml.
volumes:
- ~/.drush/:/root/.drush/
You can now run Drush commands on the container like this: docker exec drush @alias
. You can bash alias that to be something less keyboard intensive, ofcourse.
Or, Use drush from your host by invoking the SSH alias you shipped instead - drush @alias-ssh