What this image contains
Drupal is NOT included with this image! See How to use this image.
- Apache 2.4
- Drush Launcher
- PHP (latest 7.2 release)
- PHP Extensions:
- sSMPT (Simple SMTP)
- 80 (HTTP)
- 443 (HTTPS)
<a name="how"></a>How to use this image
This image is designed to serve a Drupal project, built from the Composer template for Drupal projects, from the /var/www/html directory. Below are two example methods for getting a Drupal installation into the /var/www/html directory.
Copy a drupal installation while creating a project-specific image
This is the recommended method for production and allows for rapidly deploying drupal containers.
The example Dockerfile below copies an existing Drupal installation from the host (/path/to/drupal) to the /var/www/html path inside the project-specific image.
FROM jantoine/drupal:8 # Copy the Drupal files into the container. COPY /path/to/drupal /var/www/html RUN chown -R www-data:www-data /var/www/html
Bind mount a drupal installation from the host
This is the recommended method for development and allows changes to files on the host to be reflected inside the container.
This first example bind mounts an existing Drupal installation on the host (/path/to/drupal) to the /var/www/html path in the container.
This second example bind mounts the parent directory of a Drupal installation on the host (/path/to/drupal/parent) to the /var/www path in the container, with Drupal being installed in the 'html' sub-directory.
Drupal can be configured to use various database backends, so a database backend is not included and must be linked in. The example below links the 'database_container' into our Drupal container and makes it accessible via the hostname 'db'.
sSMTP is used as the system's MTA (Mail Transfer Agent) which forwards messages to the MTA of a mailhub. sSMTP is configured to send mail to a mailhub accessible via the 'mail' hostname. The example below links the 'mailhub_container' into our Druapl container and makes it accessible via the hostname 'mail'.
The basic pattern for starting a jantoine/drupal instance is:
$ docker run --name drupal_container -P -v /path/to/drupal:/var/www/html --link database_container:db --link mailhub_container:mail -d jantoine/drupal
To easily access the container via a desired hostname, create an
nginx-proxy container and pass the hostname to the Drupal container.
The example below would make the Drupal container accessible via the example.com hostname.