🪴 rhack

Search

Search IconIcon to open search

Dockerized Drupal 9 with persistent Database

Last updated Apr 6, 2020

Until today I used to run the admin setup of my blog on my local using lando. Which was fine and is great for local dev, however I also wanted to be able to blog using my tablet or phone while not having my MacBook in front of me. In addition I do like having backups.

I’ve now set it up on my computer in my office which is running at all times anyhow, accessible from anywhere and backed up to my Synology. The setup is using Docker with a persistent database and volume for the modules/sites etc folders.

Here is the docker-compose.yml (default passwords as per bitnami image are shown):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
version: '2'
services:
  mariadb:
    image: 'docker.io/bitnami/mariadb:10.3-debian-10'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=bn_drupal
      - MARIADB_DATABASE=bitnami_drupal
    volumes:
      - './database/mariadb-persistence:/bitnami/mariadb'
  drupal:
    image: 'docker.io/bitnami/drupal:9-debian-10'
    ports:
      - '80:8080'
      - '443:8443'
    environment:
      - DRUPAL_DATABASE_HOST=mariadb
      - DRUPAL_DATABASE_PORT_NUMBER=3306
      - DRUPAL_DATABASE_USER=bn_drupal
      - DRUPAL_DATABASE_NAME=bitnami_drupal
      - ALLOW_EMPTY_PASSWORD=yes
    volumes:
      - './drupal/drupal-persistence:/bitnami/drupal'
    depends_on:
      - maria

Source: https://hub.docker.com/r/bitnami/drupal

Just run:

1
docker-compose up

and localhost should show your Drupal 9 installation.