Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
318 lines (219 sloc) 8.35 KB


Docker based development environment for Drupal 8 using only official Docker images.


  • Apache 2.4
  • PHP 7.1
  • MySQL 5.7
  • Composer
  • Drush
  • Drupal Console
  • PhPMyAdmin
  • MailHog
  • Xdebug support
  • Blackfire integration
  • HTTP2 support

Quickstart guide

To quickly get start working on your next Drupal 8 project simply follow this quickstart guide.

NB! This quickstart guide assumes that you already have your host machine set up accordingly to work with Docker and other tools.

  1. Clone this Git repository.

    $ git clone my-project
  2. Start your project services.

    $ my-project/bin/
  3. Install Drupal 8.

    $ my-project/bin/
  4. Access your project via your preferred web browser.

    $ my-project/bin/

Helper scripts

Directory bin contains many helper scripts for frequent operations that you definitely want to use to control your project in various ways. It is encourage to contribute more such scripts to improve the overall workflow when working with a Drupal project.

  • Build project services.

    Increased the PHP memory limit? Enabled some random module for Apache? Rebuild your project services easily with this helper script.

    $ my-project/bin/
  • Export project database dump.

    Quickly create a database dump and export it to your project root directory.

    $ my-project/bin/
  • Install Drupal 8.

    Kickstart your Drupal 8 project with the help of this script. Read more about it from here if you want to know what exactly happens after you have executed this script.

    $ my-project/bin/
  • Remove project files.

    Need to remove your project files and start over from scratch? Use this script to delete all your files.

    NB! Be cautious, because there is no way to restore them if you haven't added your project files to Git for example.

    $ my-project/bin/
  • Restart project services.

    Enables you to quickly restart all of your project services.

    $ my-project/bin/
  • Enter httpd service.

    $ my-project/bin/
  • Enter MySQL service.

    Drush or PhpMyAdmin aren't providing everything you need to interact with your project databases? Enter you MySQL service by using this script and start hacking SQL directly from the CLI.

    $ my-project/bin/
  • Enter PHP service.

    Need to use PHP from the command line or execute Drush or Drupal Compose against your Drupal project? Use this script to quickly enter your PHP service.

    $ my-project/bin/
  • Show project services logs.

    You have a problem with your project or some service just stopped running? Use this script to see all your project services logs for easy debugging.

    $ my-project/bin/
  • Show project services ports.

    Lists your project services exposed ports to access them easily if you have multiple projects running on your machine at the same time.

    $ my-project/bin/
  • Show project links.

    Don't like to search for Apache ports from Docker Compose process list each time you use it? Use this script to get only the relevant URL-s that you can paste directly to your web browser address bar to have a quick access to your project.

    $ my-project/bin/
  • Build and run project services.

    Need to start your project services but don't exactly remember how to do it with Docker Compose? Simply run this script from your project directory and it will start your project services for you.

    $ my-project/bin/


Sometimes you need an extra bit of functionality that Drupalstack doesn't provide by default. If you find that your changes to your stack are somewhat universal and someone else might benefit from it as well then just create a patch from your changes and add it to the patches directory.

What is .env file used for?

The .env file is used to store environment specific configuration to control your project services behaviour (e.g. Blackfire server credentials) without needing to rebuild your project services. Each time you make changes to this file you must also restart your project services. If you don't have .env file in your project root directory already then simply take the .env.sample file as a basis for your .env file as follows:

$ cp my-project/.env.sample my-project/.env

To see what else you can use this file for visit the page for more information.

NB! You should never add this file to Git.

How to change the PHP memory limit or any other php.ini directives?

  1. Open my-project/services/php/src/usr/local/etc/php/php.ini file in your preferred text editor.

  2. Make changes to existing directives or add new ones.

  3. Rebuild your project services.

    $ my-project/bin/
  4. Restart your project services.

    $ my-project/bin/

How to enable MySQL slow query log?

  1. Open my-project/services/mysql/src/etc/mysql/my.cnf file in your preferred text editor.

  2. Change line slow_query_log = 0 to slow_query_log = 1.

  3. Rebuild your project services.

    $ my-project/bin/
  4. Restart your project services.

    $ my-project/bin/
  5. Enter your MySQL service.

    $ my-project/bin/
  6. Watch /var/log/mysql/slow-query.log file for changes.

    $ tail -f /var/log/mysql/slow-query.log

How do I set up a Cron job?

  1. Open my-project/services/php/src/etc/cron.d/drupalstack file in your preferred text editor.

  2. Make changes to existing Cron jobs or add new ones.

  3. Rebuild your project services.

    $ my-project/bin/
  4. Restart your project services.

    $ my-project/bin/

How to use Drush, Drupal Console, Composer or any other command depending on PHP to interact with your project?

Since your PHP service actually runs inside an isolated environment you can't interact with it in the conventional way. So to use Drush etc. you must first shell into your running PHP service and execute your desired command from there. For example to execute a Drush command against your Drupal project, simply follow these instructions:

  1. Enter your project PHP service.

    $ my-project/bin/
  2. Change directory to Drupal root directory.

    $ cd /usr/local/apache2/htdocs/web
  3. Execute your Drush command.

    $ drush status

NB! Those same instructions are valid for all other commands as well.

How to use Blackfire to profile your website?

To use Blackfire PHP extension to profile your site, simply visit page and copy you personal server credentials Server ID and Server Token to the .env file. In that file initialize the variables BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN accordingly. After that restart your project services.

Once you have you environment properly integrated with the Blackfire service, read more from here about how to start using it in practice.

Configuring the host machine

The only dependencies for your host machine are Docker and Docker Compose. Follow the set-up instructions on and to configure your host.


  1. Fork this project.
  2. Make changes to your project repository.
  3. Create a pull request.
  4. Wait for the changes to be merged.

Where it all started

Using Docker to boost your development experience with Drupal