Easy Install Moodle Based on Docker Container

Pahrial Ms
3 min readApr 10, 2023

--

Photo by Wes Hicks on Unsplash

The Moodle Learning Management System (LMS) is an open-source software that is currently very popular and in high demand for online learning needs. With Moodle, teachers or educators can easily design and deliver materials, create assessments, facilitate communication, and collaboration among students. Its use is not limited to schools, but is also widely used in universities and corporations. Furthermore, with the rapid development of technology, efficient learning methods are needed that address factors such as time, place, and cost.

Due to its open-source nature, Moodle software is easily accessible and can be installed on any platform. In particular, in this note, I will share a simple way to install Moodle based on a Docker container using Docker Compose

Easy Install Moodle

Before installing Moodle, make sure you have prepared an environment with Docker installed. If you haven’t already, you can install Docker by following the documentation here.

After the Docker environment is ready, let’s start installing Moodle using the Docker Compose provided by Bitnami LMS powered by Moodle™ LMS. Run the following command: :

# mkdir moodle && cd moodle
# curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/moodle/docker-compose.yml > docker-compose.yml

If you want to customize the Docker volume used or the port mapping of Moodle, you can edit the downloaded Docker Compose file:

# vi docker-compose.yml

version: '2'
services:
mariadb:
image: docker.io/bitnami/mariadb:10.6
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_moodle
- MARIADB_DATABASE=bitnami_moodle
- MARIADB_CHARACTER_SET=utf8mb4
- MARIADB_COLLATE=utf8mb4_unicode_ci
volumes:
- 'mariadb_data:/bitnami/mariadb'
moodle:
image: docker.io/bitnami/moodle:4.1
ports:
- '5006:8080'
- '5007:8443'
environment:
- MOODLE_DATABASE_HOST=mariadb
- MOODLE_DATABASE_PORT_NUMBER=3306
- MOODLE_DATABASE_USER=bn_moodle
- MOODLE_DATABASE_NAME=bitnami_moodle
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- 'moodle_data:/bitnami/moodle'
- 'moodledata_data:/bitnami/moodledata'
depends_on:
- mariadb
volumes:
mariadb_data:
driver: local
moodle_data:
driver: local
moodledata_data:
driver: local

In this note, I only changed the port mapping of Moodle, leaving everything else as default. Next, let’s run the Docker Compose to start installing Moodle:

# docker compose -f docker-compose.yml up -d
[+] Running 2/2
✔ Container moodle-mariadb-1 Started 0.6s
✔ Container moodle-moodle-1 Started

# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8d0a123dfb0d bitnami/moodle:4.1 "/opt/bitnami/script…" 24 seconds ago Up 21 seconds 0.0.0.0:5006->8080/tcp, :::5006->8080/tcp, 0.0.0.0:5007->8443/tcp, :::5007->8443/tcp moodle-moodle-1
ba2c94bab596 bitnami/mariadb:10.6 "/opt/bitnami/script…" 24 seconds ago Up 22 seconds 3306/tcp moodle-mariadb-1

Moodle has been successfully installed, now let’s test access to the Moodle web through the port mapping we have defined in the Docker Compose file above.

http://<IP-DOCKER-HOST>:<PORT-MAPPING>

Login with default user : user dan password : bitnami

Next, you can start managing the LMS according to your needs.

It’s that easy, isn’t it?

--

--