Drupal Docker Container
Drupal is a content management system (CMS) that allows you create dynamic web sites. It can be somewhat difficult to install because it has a lot of dependencies. Using a docker container to perform the install makes the installation process easier.
Also, see Using Drupal and DITA OT to Create a PDF File for a Drupal use case.
Docker-compose.yml:
# Database username: postgres
# Database password: example
# ADVANCED OPTIONS; Database host: postgres
#
version: '3.1'
services:
drupal:
image: my-drupal:latest
ports:
- 8080:80
volumes:
- modules:/var/www/html/modules
- profiles:/var/www/html/profiles
- themes:/var/www/html/themes
# this takes advantage of the feature in Docker that a new anonymous
# volume (which is what we're creating here) will be initialized with the
# existing content of the image at the same location
- sites:/var/www/html/sites
restart: none
postgres:
image: postgres:16
environment:
POSTGRES_PASSWORD: example
restart: none
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
modules:
profiles:
themes:
sites:
pgdata:
I created my own image (see Dockerfile that follows) to include Composer and the REST UI module.
Dockerfile:
FROM drupal:latest
# Install Composer
COPY --from=composer/composer:latest-bin /composer /usr/local/bin/composer
# Install REST UI module
RUN composer require drupal/restui
ENV DRUSH_VERSION 8.4.9
RUN curl -L --silent https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar \
> /usr/local/bin/drush && chmod +x /usr/local/bin/drush
Here's the command to build the docker image:
docker build -t my-drupal:latest .
Use PostgreSQl as the database type.
Use postgres as the database name.
Use postgres as the database user name.
Use example as the database password.
Use postgres as the host.
Use 5432 as the port number.
Comments