This repository contains Docker configuration files to run Moodle 4.5+ with all required dependencies.
- Docker and Docker Compose installed on your system
- Minimum 2GB RAM recommended for Docker
- Clone this repository
- Run the following command to start Moodle:
docker-compose up -d- Access Moodle at http://localhost:8080
The default setup uses PostgreSQL 14, but you can switch to MySQL 8.4 or MariaDB 10.11 by uncommenting the appropriate section in the docker-compose.yml file.
You can customize your Moodle installation by modifying the environment variables in the docker-compose.yml file:
MOODLE_DATABASE_TYPE: Database type (pgsql, mysqli)MOODLE_DATABASE_HOST: Database hostnameMOODLE_DATABASE_PORT: Database portMOODLE_DATABASE_NAME: Database nameMOODLE_DATABASE_USER: Database usernameMOODLE_DATABASE_PASSWORD: Database passwordMOODLE_SITE_FULLNAME: Full name of your Moodle siteMOODLE_SITE_SHORTNAME: Short name of your Moodle siteMOODLE_ADMIN_USER: Admin usernameMOODLE_ADMIN_PASSWORD: Admin passwordMOODLE_ADMIN_EMAIL: Admin email address
moodledata: Persistent storage for Moodle datapostgres_data: Persistent storage for PostgreSQL data (or mysql_data/mariadb_data if using MySQL/MariaDB)
- PHP 8.2+ with all required extensions
- PHP
max_input_varsset to 5000 - Sodium extension enabled
- Apache web server with mod_rewrite enabled
- PostgreSQL 14 (default), MySQL 8.4, or MariaDB 10.11 options available
For production deployment, consider:
- Using a reverse proxy with SSL termination
- Setting up regular backups for the database and moodledata volume
- Adjusting PHP and database settings for better performance
- Setting secure passwords for all services
If you encounter issues:
- Check Docker logs:
docker-compose logs -f - Verify database connection settings
- Ensure proper permissions on the moodledata directory