- If not using DrupalConsole you will need to add the
vlucas/phpdotenv
dependency to load the.env
file. You can do that using composer:
composer require vlucas/phpdotenv
- Add the
TRAEFIK_HOST
value to/etc/hosts
127.0.0.1 site.local
# Start containers using detached mode flag to run in background.
docker-compose up -d
# Stop containers. You can destroy the internal volumes using the -v flag.
docker-compose down
# Execute composer on the container
docker-compose exec --user=82 php composer COMMAND_NAME
To execute DrupalConsole on the container you can create a site alias at path/to/site/console/sites/site.yml
local:
root: /var/www/html
extra-options: docker-compose exec --user=82 php
type: container
And execute using
drupal @site.local COMMAND_NAME
More info at https://docs.drupalconsole.com/en/alias/using-site-alias.html https://docs.drupalconsole.com/en/alias/connecting-to-a-virtual-environment.html