Skip to content

Instantly share code, notes, and snippets.

@markshust
Last active February 28, 2017 16:43
Show Gist options
  • Select an option

  • Save markshust/77540031cd25ebc23074a10c76c1b090 to your computer and use it in GitHub Desktop.

Select an option

Save markshust/77540031cd25ebc23074a10c76c1b090 to your computer and use it in GitHub Desktop.
Setup Drupal 8 on Docker

#Installing Drupal 8 with Docker

First, create and enter a directory on your host machine to act as a project root:

mkdir -p ~/Sites/drupal8 && cd $_

Then, execute the following line to use Composer to install the Drupal 8 files with correct permissions into a www subdirectory of your project root:

docker run --rm -v $PWD/html:/var/www/html composer create-project drupal-composer/drupal-project:8.x-dev /var/www/html --stability dev --no-interaction

When the Composer execution completes, your host machine should now contain a directory with Drupal source files at ~/Sites/drupal8/html.

Start MySQL container:

docker run --rm -p 33061:3306 -v ~/Sites/drupal8/datadir:/var/lib/mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=true --name mysql mysql

Then start the PHP container, linking the volume and MySQL container:

docker run --rm -v ~/Sites/drupal8/html:/var/www/html --link mysql --name phpfpm php:7-fpm

Then run the nginx container:

docker run --rm -p 8001:80 -v ~/Sites/drupal8/html:/var/www/html --name web --link phpfpm nginx:drupal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment