PHP container

PHP is used with Nginx via PHP-FPM.


PHP container has installed drush. When running drush make sure to open the shell as user 82 (www-data) to avoid access problems in the web server, which is running as user 82, too:

$ docker-compose exec --user 82 php drush

Also, you can use preconfigured drush alias @dev:

$ docker-compose exec --user 82 php drush @dev


PHP container has installed composer. Example:

$ docker-compose exec --user 82 php composer update

Drupal Console

PHP container has installed drupal launcher. Drupal console itself must be installed per project manually via composer.


If you want to use Xdebug, uncomment this line to enable it in the compose file before starting containers:

PHP_XDEBUG: 1                 # Enable Xdebug extension
PHP_XDEBUG_DEFAULT_ENABLE: 1  # Comment out to disable (default).

If you would like to autostart xdebug, uncomment this line:

PHP_XDEBUG_REMOTE_AUTOSTART: 1     # Comment out to disable (default).

Xdebug on Mac OS X

There are two more things that need to be done on macOS in order to have Xdebug working (because there's no docker0 interface). Enable Xdebug as described in the previous section and uncomment the following two lines:

PHP_XDEBUG_REMOTE_CONNECT_BACK: 0         # Disabled for to work (enabled by default)
PHP_XDEBUG_REMOTE_HOST: ""  # Setting the host (localhost by default)

You also need to have loopback alias with IP from above. You need this only once and that settings stays active until logout or restart.

sudo ifconfig lo0 alias

To add the loopback alias after a reboot, add the following contents to /Library/LaunchDaemons/docker4drupal.loopback.plist

<plist version="1.0">
    <string>Default Loopback alias</string>

Xdebug on Windows

You should do same things as for Mac OS. Enable Xdebug as described in the previous 2 sections and replace value of PHP_XDEBUG_REMOTE_HOST to your DockerNAT ip assigned (by default it should be

PHP_XDEBUG_REMOTE_HOST: ""  # Setting the host (localhost by default)

You also need to check firewall not to block your connection. Disabling firewall should help.


  1. Inside your drupal/core directory, copy the file phpunit.xml.distand rename it to phpunit.xml
  2. Open that file and make sure that you update SIMPLETEST_BASE_URL to http://nginx
  3. In order to make sure that your DB connection is working as well, update SIMPLETEST_DB to mysql://drupal:drupal@mariadb/drupal


See the list of environment variables available for customization at wodby/drupal-php.