Drupal Docker Tutorial

Drupal tutorials webdesign videos
Lightning fast hosting for a shockingly low price! 50% off GoDaddy Hosting plans



Creating a Drupal dev environment in less than 10 minutes with Docker on a Mac.

This tutorial supposes Docker already installed, and shows how to create two containers, one for MySql, one for Drupal 8, link both and configure the Drupal 8 install.

To install Docker, follow the instructions written here: https://www.docker.com/community-edition

===

Here are the commands typed in the movie:

Here is the docker command to launch a MySQL 5.7 container, name it “drupaltutorialmysql”, set a few environment variables, expose the MySQL port 3306 as 3308 on the local host and daemonise it:

docker run
–name drupaltutorialmysql
-e MYSQL_ROOT_PASSWORD=my-secret-pw
-e MYSQL_DATABASE=drupalTutorial
-e MYSQL_USER=DrupalWebSite
-e MYSQL_PASSWORD=DrupalDemoPass
-p 3308:3306
-d
mysql:5.7

Here is the docker command to launch Drupal 8 in a “drupaltutorial” container, link it to the previous container’s MySQL port, expose it’s web port 80 as 8010 on the local host and daemonise it:

docker run
–name drupaltutorial
–link drupaltutorialmysql:mysql
-p 8010:80
-d
drupal:8

To run a Drupal 7 instance instead, just replace drupal:8 with drupal:7

source

8 thoughts on “Drupal Docker Tutorial”

  1. not working for me, when try to connection to mysql from sequel pro i get this errors:

    Can not connect to host 127.0.0.1, or the request has expired.

    Check that the address is correct and that you have the correct privileges, or try to increase the connection timeout (currently 10 seconds).

    MySQL returned: Authentication plugin 'caching_sha2_password' can not be loaded: dlopen (/usr/local/lib/plugin/caching_sha2_password.so, 2): image not found

    and of course i put correctly all information:

    docker run
    > –name drupaltutorialmysql
    > -e MYSQL_ROOT_PASSWORD=my-secret-pw
    > -e MYSQL_DATABASE=drupalTutorial
    > -e MYSQL_USER=DrupalWebSite
    > -e MYSQL_PASSWORD=DrupalDemoPass
    > -p 3308:3306
    > -d
    > mysql

  2. Thanks bro for this nice clear tutorial, I've just one question: how to edit a container configuration for example enable mod_rewrite for apache2 container and so on.. THANKS 🙂

  3. hi, thanks for the tutorial. I am a beginner to docker and I followed your tutorial and was able to spin up a new drupal 8 site as stated in your tutorial. But unable to locate the codebase ? can you help on this.

Leave a Reply

Your email address will not be published. Required fields are marked *