This image contains the latest stable Drupal 7-release. It will automatically setup the database and install a default site.
The image doesn't contain a database so you have to create a seperate database container (which is no effort if you use the provided configuration for docker-compose) and link this container or pass the database information of a MySQL- or Postgres-host.
Many of the other Drupal images got a database baked in or didn't install Drupal automatically and didn't offer much flexibility. This image can be easily be used as base image for your own Drupal images see below Customization by using Dockerfiles. At the same time you can just use this image for a vanilla Drupal-experience that can be fully administered and extended via the web-interface as well as with drush on the command-line.
If you want to launch a bare Drupal image with a MySQL backend you can do so:
docker run -d -e MYSQL_ROOT_PASSWORD="test123" --name db mysql
docker run -d --link db:mysql -p 80:80 samos123/drupal
Alternatively you can use Docker-Compose
in a directory that contains the provided docker-compose.yml
:
docker-compose up
This will launch a new drupal site with a default theme and no additional modules. If you want custom modules, see Customization.
As customizations and uploads are stored you must take care of these directories if you want to keep these:
/var/www/html/sites
(modules, themes, uploaded files)/var/www/private
(non-public files, e.g. to store backups)As these folders are defined as volumes in the sample docker-compose.yml
,
you can easily update your container to use the latest image while preserving
any modifications with:
docker-compose pull && docker-compose up -d
You can use a linked database-container with the alias mysql
or postgres
as
shown above - Drupal will be automatically configured to it. Or you use an
external database-host. Therefore pass the following environment variables to
your container:
DB_DRIVER
mysql
(default) and pgsql
DB_HOST
DB_PORT
3306
if DB_DRIVER
== 'mysql'5432
if DB_DRIVER
== 'pgsql'DB_NAME
drupal
DB_USER
root
if DB_DRIVER
== 'mysql'postgres
if DB_DRIVER
== 'pgsql'DB_PASS
You can alternatively use a Postgres container. The configuration is very
similar to that of MySQL as seen in the docker-compose.yml
file, with a
couple small changes.
There is an example docker-compose.yml
available in the examples folder.
VIRTUAL_HOST
- sets the ServerName
-directive for httpd and Drupal's
base_url
configuration variable; handy in conjunction with
jwilder/nginx-proxy
SERVERNAME
- use this to explicitly set httpd's ServerName
-directive
/etc/hostname
will be
usedBASE_URL
- explicitly set the base_url
configuration variable for
Drupal
BASE_URL_PROTO
(default: https://
) - if BASE_URL
is derived from
VIRTUAL_HOST
, this will be prefixed as protocolUPLOAD_LIMIT
(default: 10M
) - sets variables for the PHP-interpreter
to control maximum upload sizesMEMORY_LIMIT
(default: 64M
) - sets the memory_limit
for the PHP-interpreterADMIN_USER
(default: admin
) - sets the administrator account name when
creating a new instanceADMIN_PASSWORD
- (default: changeme
) sets the administrator password when
creating a new instance.To create a customized Drupal-image, you can add/modify scripts in a derived
image or mount them in your container into these directories:
/scripts/setup.d
and /scripts/pre-launch.d
. Furthermore,
_
and -
chmod a+x <scriptpath>
)See the folder examples on how to use the Zen-template and the modules_filter-module and build an image containing them.
Drush's system-wide configuration (/etc/drushrc.php
) sets its default-
behaviour to be verbose (-v
) and affirmative (--yes
) in order to grant easy
and elaborated usage of scripts. If you want to change that behaviour in an
interactive environment or for certain sites (e.g. `docker exec -ti