What this image contains
- Apache 2.4
- Composer (latest stable release)
- Drupal* (latest stable release)
- Drush (latest stable release)
- PHP (latest stable release)
- PHP Extensions:
- sSMPT (Simple SMTP)
*Drupal is NOT included with this image, but is installed upon creation of a container from this image, only if the /var/www/html directory is empty. The pros are that the image footprint is kept small and Drupal can either be bind mounted from the host or installed in the container. The con is that if Drupal is not bind mounted from the host, it can take several minutes for Drupal to finish installing when new containers are created. When the containers 'State:Health:Status' property is 'healthy', Drupal is installed and ready to serve requests.
- 80 (HTTP)
- 443 (HTTPS)
How to use this image
This image serves Drupal from the /var/www/html folder. 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.
If a Drupal installation is not bind mounted to the container leaving the /var/www/html directory empty, the "Composer template for Drupal projects" (https://github.com/drupal-composer/drupal-project) will be built to the /var/www directory and a symlink will be created from the 'web' directory to the 'html' 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.