An example Docker container for Drupal projects using PHP7.0, HTTP/2; inheriting from andrewholgate/drupal-php70-dev.
- Basic knowledge of Docker
- Knowledge of how to customise docker-compose.yml
# Build database image based off MySQL 5.7
sudo docker run -d --name drupal-php70-mysql mysql:5.7 --entrypoint /bin/echo MySQL data-only container for Drupal project PHP7.0
# Clone Drupal development docker rep
git clone https://github.com/andrewholgate/docker-drupal-php70-example.git
cd docker-drupal-php70-example
# Customise docker-compose.yml file according to project requirements.
cp docker-compose.yml.dist docker-compose.yml
vim docker-compose.yml
# Customise Dockerfile according to project requirements.
vim Dockerfile
# Build docker containers using Docker Compose.
sudo docker-compose build --no-cache | tee ./build.log
sudo docker-compose up -d
From the host server, add the web container IP address to the hosts file executing the following script
# Add the web container IP address to hosts file
./host.sh
# Using the container name of the web frontend.
sudo docker exec -it dockerdrupalphp70example_drupalphp70exampleweb_1 su - ubuntu
This example assumes the project root is under ~/develop/projects/drupal-example
. It can be modified when copying docker-compose.yml.dist
The setup.sh can be used to add symlinks to the project root for Apache, etc.