This repository provides a Docker Compose setup for Moodle, allowing you to quickly spin up a local Moodle development environment with all necessary dependencies. It includes PHP, MySQL, phpMyAdmin, and a cron service for background tasks.
This setup is designed for development and testing, but can be adapted for production with proper security measures.
- Clone the repository:
git clone <repo-url>
cd <repo-folder>
- Download Moodle:
Download the latest Moodle version from Moodle downloads and extract it into a moodle
folder:
moodle/ */ ← place extracted Moodle files here
moodledata/ */ ← Moodle data folder (will be created automatically if missing)
- Start the containers:
docker-compose up -d
- Access your services:
- Moodle site: http://127.0.0.1
- phpMyAdmin: http://127.0.0.1:8080
- Host:
mysql
- User/Password:
docker
- Host:
- Adjust Permissions:
For this, see perms.sh
- Base image:
php:8.4-apache
- Installed extensions:
gd, pdo, pdo_mysql, zip, mysqli, intl, soap, exif
- Apache modules:
rewrite, deflate, filter, expires
- Custom PHP config:
php/custom-php.ini
- Locale:
C.UTF-8
- Do not expose phpMyAdmin (
8080
) to the public. - Bind MySQL to
127.0.0.1
(Windows) or172.17.0.1
(Linux/macOS) in production to prevent public access. - Always secure your MySQL credentials before deploying.