A complete Docker-based development environment for Moodle LMS with PostgreSQL database and pgAdmin interface.
- Overview
- Prerequisites
- Quick Start
- Detailed Setup
- Usage
- Development
- Configuration
- Troubleshooting
- Project Structure
This Docker setup provides a complete Moodle development environment with:
- Moodle 4.4.10 (not the latest version, Haven't test the letest one yet)
- PHP 8.3 with Apache
- PostgreSQL 17 database
- pgAdmin 4 for database management
- Local file mounting for easy development
Before you begin, ensure you have the following installed:
- Docker (version 20.10 or higher)
- Docker Compose (version 2.0 or higher)
- Git (for cloning Moodle files)
-
Clone this repository:
git clone https://github.com/AshFahim/moodle-docker.git cd moodle_docker -
Download and setup Moodle files:
# Download Moodle 4.4.10 wget -O moodle-latest.tgz https://download.moodle.org/download.php/direct/stable404/moodle-latest-404.tgz # Extract to moodle directory tar -xzf moodle-latest.tgz -C moodle --strip-components=1 # Clean up rm moodle-latest.tgz
-
Start the environment:
docker-compose up -d --build
-
Access Moodle:
- Open your browser and go to
http://localhost - Follow the Moodle installation wizard
- Open your browser and go to
# Clone the repository
git clone https://github.com/AshFahim/moodle-docker.git
cd moodle_docker
# Create moodle directory
mkdir moodleYou have several options to get Moodle files:
# Download Moodle 4.4.10
wget -O moodle-latest.tgz https://download.moodle.org/download.php/direct/stable404/moodle-latest-404.tgz
# Extract to moodle directory
tar -xzf moodle-latest.tgz -C moodle --strip-components=1
# Clean up
rm moodle-latest.tgz# Clone Moodle repository
git clone https://github.com/moodle/moodle.git moodle
# Switch to stable branch
cd moodle
git checkout MOODLE_404_STABLE
cd ..# Copy your existing Moodle files
cp -r /path/to/your/moodle/* ./moodle/# Build and start all services
docker-compose up -d --build
# Check if all containers are running
docker-compose ps| Service | URL | Credentials |
|---|---|---|
| Moodle | http://localhost | Setup during installation |
| pgAdmin | http://localhost:81 | admin@admin.com / adminpassword |
When setting up Moodle, use these database credentials:
- Database type: PostgreSQL
- Database host:
postgres - Database name:
moodle - Database user:
moodle_user - Database password:
moodle_password - Database port:
5432
# Start services
docker-compose up -d
# Stop services
docker-compose down
# Stop and remove volumes (⚠️ This will delete all data)
docker-compose down --volumes
# View logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f moodleappmoodle_test/
├── docker-compose.yml # Docker services configuration
├── dockerfile # Moodle container configuration
├── entrypoint.sh # Container startup script
├── moodle/ # Moodle files (mounted to container)
│ ├── index.php
│ ├── config.php
│ └── ...
└── README.md # This file