This project provides a Docker-based setup for a persistent Drupal website with a pre-configured MariaDB database.
- Docker installed on your machine.
- Docker Compose installed on your machine.
-
Create a
docker-compose.yml
file:version: '3.8' services: drupal: image: mesfinm/drupal-persistent:latest ports: - "8081:80" volumes: - './drupal-data:/var/www/html' depends_on: - 'mariadb' mariadb: image: 'mariadb' environment: MARIADB_ROOT_PASSWORD: 'root' MARIADB_DATABASE: 'database2' MARIADB_USER: 'database2' MARIADB_PASSWORD: 'database2' volumes: - './mariadb-data:/var/lib/mysql' adminer: image: 'adminer' ports: - "8092:8080" depends_on: - 'mariadb' volumes: drupal-data: mariadb-data:
-
Start the Services:
docker-compose up -d
The Drupal site will be accessible at
http://localhost:8081
and Adminer athttp://localhost:8092
.
- drupal-data/: Stores Drupal site data.
- mariadb-data/: Stores MariaDB data.
These directories are mounted as volumes in the Docker containers to ensure data persists across container restarts.
To stop and remove the containers, run:
docker-compose down
To remove the persistent data, delete the drupal-data and mariadb-data directories:
rm -rf drupal-data mariadb-data