Docker4Drupal Getting Started

Docker4Drupal is a set of docker containers optimized for Drupal. Use docker-compose.yml file from docker4drupal repository to spin up local environment on Linux, Mac OS X and Windows.

Docker4Drupal is designed to be used for local development, if you're looking for a production solution see using in production.

Overview

The Drupal stack consist of the following containers:

Container Versions Service name Image Enabled by default
Nginx 1.13, 1.12 nginx wodby/drupal-nginx
Apache 2.4 apache wodby/php-apache
Drupal 8, 7, 6 php wodby/drupal
PHP 7.1, 7.0, 5.6, 5.3 php wodby/drupal-php
MariaDB 10.1 mariadb wodby/mariadb
Redis 3.2, 4.0 redis wodby/redis
Varnish 4.1 varnish wodby/drupal-varnish
Solr 6.x, 5.5, 5.4 solr wodby/drupal-solr
Node.js 1.0 nodejs wodby/drupal-node
Memcached 1.4 memcached wodby/memcached
Webgrind 1.5 webgrind wodby/webgrind
Blackfire latest blackfire blackfire/blackfire
Rsyslog latest rsyslog wodby/rsyslog
AthenaPDF 2.10.0 athenapdf arachnysdocker/athenapdf-service
Mailhog latest mailhog mailhog/mailhog
Adminer 4.3 adminer wodby/adminer
phpMyAdmin latest pma phpmyadmin/phpmyadmin
Node latest node _/node
Portainer latest portainer portainer/portainer
Traefik latest traefik _/traefik

Supported Drupal versions: 8 / 7 / 6

Requirements

Must know before you start

  1. (!!!) You will lose MariaDB data if you run docker-compose down. Instead use docker-compose stop to stop containers. Alternatively, you can use a manual volume for mariadb data (see compose file), this way your data will always persist
  2. To avoid potential problems with permissions between your host and containers please follow these instructions
  3. For macOS users: Out of box Docker for Mac volumes has poor performance. However there are workarounds, read more here
  4. For better reliability we release images with stability tags (e.g. wodby/drupal-php:7.1-X.X.X) which correspond to git tags. We strongly recommend using images only with stability tags.

Usage

There are 2 options how to use docker4drupal – you can either run vanilla Drupal from the image or mount your own Drupal codebase:

1. Run Vanilla Drupal from Image (default)

  1. Download docker-compose.yml file from the latest stable release
  2. Optional: update php and nginx images tags if you want to run Drupal 7 or 6 (by default Drupal 8)
  3. Run containers: docker-compose up -d (it may take some time for them to initialize)
  4. Configure domains
  5. That's it! Proceed with Drupal installation at http://drupal.docker.localhost:8000. Default database user, password and database name are all drupal, database host is mariadb
  6. You can see status of your containers and their logs via portainer: http://portainer.drupal.docker.localhost:8000

2. Mount my Drupal Codebase

  1. Read must know before you start
  2. Download docker-compose.yml file from the latest stable release to your Drupal project root
  3. Replace php image from wodby/drupal (PHP + vanilla Drupal) to wodby/drupal-php (just PHP)
  4. Depending on your Drupal version use appropriate tags for php and nginx images
  5. Update nginx and php volumes to - ./:/var/www/html to mount your codebase
  6. Update NGINX_SERVER_ROOT (or APACHE_SERVER_ROOT) to /var/www/html unless your project is based on composer template
  7. Ensure your settings.php uses the same credentials as mariadb service
  8. Optional: import existing database
  9. Optional: uncomment lines in the compose file to run redis, solr, etc
  10. Configure domains
  11. Run containers: docker-compose up -d
  12. That's it! Your drupal website should be up and running at http://drupal.docker.localhost:8000. If you need to run multiple projects simultaneously see this article
  13. You can see status of your containers and their logs via portainer: http://portainer.drupal.docker.localhost:8000

You can stop containers by executing:

docker-compose stop

Feel free to adjust volumes and ports in the compose file for your convenience. Also, read how to access containers and how to get logs

Status

We're actively working on these instructions and containers. More options will be added soon. If you have a feature request or found a bug please submit an issue on GitHub or Wodby Slack join us on Slack

We update containers from time to time by releasing new images (stability tags change).

License

This project is licensed under the MIT open source license.