Posted under » PHP » System Admin on 16 Apr 2025
From docker intro...
Moodle™ LMS is an open source online Learning Management System widely used at universities, schools, and corporations. It is modular and highly adaptable to any type of online learning.
I can't install the latest Moodle directly because my Ubuntu uses an older version of PHP. I did consider upgrading the PHP but I want to try using Docker instead.
So I look for moodle in docker hub and this seems to be the most reliable (released on a regular basis with the latest distribution packages available). First thing I see is a Warning: This quick setup is only intended for development environments.
As usual, it is recommended that you pull the image from the hub
$ docker pull bitnami/moodle:latest
This step is unecessary because you will create a volume for Moodle™ persistence later (below)
Bitnami Moodle uses the Docker Image for MariaDB for the database requirements.It is running on the internal Docker network. Create one if it has not been created.
$ docker network create moodle-network
Create a volume for MariaDB persistence and create a MariaDB container
$ docker volume create --name mariadb_data docker run -d --name mariadb \ --env ALLOW_EMPTY_PASSWORD=yes \ --env MARIADB_USER=bn_moodle \ --env MARIADB_PASSWORD=bitnami \ --env MARIADB_DATABASE=bitnami_moodle \ --network moodle-network \ --volume mariadb_data:/bitnami/mariadb \ bitnami/mariadb:latest
Create volumes for Moodle™ persistence and launch the container
$ docker volume create --name moodle_data docker run -d --name moodle \ -p 8080:8080 -p 8443:8443 \ --env ALLOW_EMPTY_PASSWORD=yes \ --env MOODLE_DATABASE_USER=bn_moodle \ --env MOODLE_DATABASE_PASSWORD=bitnami \ --env MOODLE_DATABASE_NAME=bitnami_moodle \ --network moodle-network \ --volume moodle_data:/bitnami/moodle \ --volume moodledata_data:/bitnami/moodledata \ bitnami/moodle:latest
You can then run moodle already at port 8080. You will also see that
[::]:8080->8080/tcp, 0.0.0.0:8443->8443/tcp
I really don't care much about 8443 because I don't need it for SSL. With port 8080 I can convert it to 80 by reverse proxy. Notice that both moodle and mariadb is using the 'moodle-network'. However, mariadb port 3306 is not exposed and is used internally by 'moodle-network'.
Volumes are created at /var/lib/docker/volumes but you can't edit it or read only or stateless.
You may prefer installing Moodle the regular way »