Start common apps like mysql and mailhog (you need those first):
export MYSQL_DATA=/my/mysql/datafolder; cd /path/to/docker-compose-drupal/common-apps && docker-compose up -d
Add this command to your boot-scripts.
This gives you
- mysql: 1 mysql-container for all persistent databases.
Available at
localhost:3306
and from your containers atmysql
. Username / password:root
androot
. - mailhog: This is a mailsink with web UI where php-containers will send all email to. Note that only containers started with the project docker-compose.yml from this repo will use this! Available at http://mailhog.dev:8025/
- devdns: This is the central dns-container that provides you the .dev domain and project hostnames. If this is not started, functionality from this repo won't work well (if not at all).
edit /etc/dhcp/dhclient.conf add: supersede domain-name "dev"; prepend domain-name-servers 127.0.0.1; see: https://github.com/ruudud/devdns
Copy drupal-project/docker-compose.yml
and drupal-project/.env
to your project.
Edit .env
and docker-compose.yml
.
Run docker-compose up -d
.
To stop, run docker-compose down
.
Try to use d4d-unison-sync
in drupal-project/docker-compose.yml .
Have not tested with it yet, so you're on your own.
Read: http://docs.docker4drupal.org/en/latest/macos/ .
To avoid potential permissions problems between host machine and containers (e.g. can't access files generated by PHP) you can add a group on your host machine with ID 82, it's a standard GID/UID for www-data user in Alpine Linux. Read: http://docs.docker4drupal.org/en/latest/permissions/
Run docker-compose logs -f php
from your project folder to tail the php logs.
You might want to add these aliases to your ~/.bashrc file (restart terminal to take effect):
alias ddrush='docker-compose exec --user 82 php drush'
alias dcomposer='docker-compose exec --user 82 php composer'
alias ddrupal='docker-compose exec --user 82 php drupal'
# Note the 'up' alias adds a workaround to provide working DNS for each php-container.
# Drupal needs this for background_process support etc.
alias up='export DOCKERDNS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" dockerdns); docker-compose up'
alias down='docker-compose down'
alias restart='docker-compose down; docker-compose up -d'
alias logs='docker-compose logs -f php'