Drupal image built with Ansible.
50K+
This project is composed of three main parts:
geerlingguy/drupal Docker image in your project, you can pull it from Docker Hub.geerlingguy.docker on Ansible Galaxy. (This is the Ansible role that does the bulk of the work in managing the Docker container.)Currently maintained versions include:
latestlatest-arm64latest-arm32v7The easiest way to use this Docker image is to place the docker-compose.yml file included with this project in your Drupal site's root directory, then customize it to your liking, and run:
docker-compose up -d
You should be able to access the Drupal site at http://localhost/, and if you're installing the first time, the Drupal installer UI should appear. Follow the directions and you'll end up with a brand new Drupal site!
The image downloads Drupal into /var/www/html if you don't have a Drupal codebase mounted into that path by default. You can override this behavior (if, for example, you are sharing your codebase into /var/www/html/web or elsewhere) by setting the environment variable DRUPAL_DOWNLOAD_IF_NOT_PRESENT=false.
To get your Drupal codebase into the container, you can either COPY it in using a Dockerfile, or mount a volume (e.g. when using the image for development). The included docker-compose.yml file assumes you have a Drupal codebase at the path ./web, but you can customize the volume mount to point to wherever your Drupal docroot exists.
If you don't supply a Drupal codebase in the container in /var/www/html, this container's docker-entrypoint.sh script will download Drupal for you (using the DRUPAL_DOWNLOAD_VERSION). By default the image uses the latest development release of Drupal, but you can override it and install a specific version by setting DRUPAL_DOWNLOAD_VERSION to that version number (e.g. 8.5.3).
settings.phpSince it's best practice to not include secrets like database credentials in your codebase, this Docker container recommends putting connection details into runtime environment variables, which you can include in your Drupal site's settings.php file via getenv().
For example, to set up the database connection, pass settings like DRUPAL_DATABASE_NAME:
$databases['default']['default'] = [
'driver' => 'mysql',
'database' => getenv('DRUPAL_DATABASE_NAME'),
'username' => getenv('DRUPAL_DATABASE_USERNAME'),
'password' => getenv('DRUPAL_DATABASE_PASSWORD'),
'host' => getenv('DRUPAL_DATABASE_HOST'),
'port' => getenv('DRUPAL_DATABASE_PORT'),
];
You may also want to set a DRUPAL_HASH_SALT environment variable to drive the $settings['hash_salt'] setting.
The default Apache document root is /var/www/html. If your codebase needs to use a different docroot (e.g. /var/www/html/web for Composer-built Drupal projects), you should set the environment variable APACHE_DOCUMENT_ROOT to the appropriate directory, and the container will change the docroot when it starts up.
Content type
Image
Digest
sha256:d904756c2…
Size
278.4 MB
Last updated
about 2 years ago
docker pull geerlingguy/drupal