Public Repository

Last pushed: 3 days ago
Short Description
A complete moodle installation with preinstalled admin user and automatic database setup.
Full Description

Supported tags and respective Dockerfile links

A Dockerfile that installs and runs the latest Moodle 3.2 stable, with external MySQL/Mariadb/Postgresql Database and automatic installation with a default predefined administrator user.

Usage

Running

Apache - based images

To spawn a new instance of Moodle:

  • Using mysql:
docker run -d --name DB -e MYSQL_DATABASE=moodle -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_ONETIME_PASSWORD=yes -e MYSQL_USER=moodle -e MYSQL_PASSWORD=moodle mysql
docker run -d -P --name moodle --link DB:DB -e MOODLE_URL=http://0.0.0.0:8080 -p 8080:80 ellakcy/moodle
  • Using mariadb:
docker run -d --name DB -e MYSQL_DATABASE=moodle -e MYSQL_RANDOM_ROOT_PASSWORD=yes -e MYSQL_ONETIME_PASSWORD=yes -e MYSQL_USER=moodle -e MYSQL_PASSWORD=moodle mariadb
docker run -d -P --name moodle --link DB:DB -e MOODLE_URL=http://0.0.0.0:8080 -e MOODLE_DB_TYPE="mariadb" -p 8080:80 ellakcy/moodle
  • Using postgresql
docker run --name=DB -e POSTGRES_USER=^a database user^ -e POSTGRES_PASSWORD=^a database password^ -e POSTGRES_DB=^a database name^ -d postgres
docker run -d -P --name moodle --link DB:DB -e MOODLE_URL=http://0.0.0.0:8080 -e MOODLE_DB_TYPE="pgsql" -p 8080:80 ellakcy/moodle

Then you can visit the following URL in a browser to get started:

http://0.0.0.0:8080

Fpm based images

For fpm based images is recomended to use docker-compose. Have a look on https://github.com/ellakcy/docker-moodle for more info.

Enviromental Variables

Also you can use the following extra enviromental variables (using -e option on docker run command):

  • For default user:
Variable Name Default value Description
MOODLE_URL http://0.0.0.0 The url of the site that moodle is setup
MOODLE_ADMIN admin The default administrator's username
MOODLE_ADMIN_PASSWORD Admin~1234 The administrator's default password. PLEASE DO CHANGE ON PRODUCTION
MOODLE_ADMIN_EMAIL admin@example.com Administrator's default email.
  • For database management:
Variable Name Default value Description
MOODLE_DB_TYPE mysqli The type of the database it can be one of these values: mysql for Mysql Database, mariadb for Mariadb Database, pgsql for Postgresql Database
MOODLE_DB_HOST The url that the database is accessible
MOODLE_DB_PASSWORD The password for the database
MOODLE_DB_USER The username of the database
MOODLE_DB_NAME The database name
MOODLE_DB_PORT The port that the database is accessible

If no value specified and the the container that runs the current docker image is conencted to another database container then depending the value of MOODLE_DB_TYPE it will autodetect the correct parameters.

Volumes

Also you can use the following volumes:

  • /var/moodledata In order to get all the stored data.
  • For fpm based images the path /var/www/html where it contains the application's source code.

Bugs

If any bug please we beg you to let us know on: https://github.com/ellakcy/docker-moodle/issues

Caveats

The following aren't handled, considered, or need work:

  • moodle cronjob (should be called from cron container)
  • log handling (stdout?)
  • email (does it even send?)

Credits

This is a fork of JmHardison's (https://github.com/jmhardison/docker-moodle) Dockerfile. Special thanks to moodle's community and Ellakcy members for occationaly helping me out.

Docker Pull Command
Owner
ellakcy

Comments (0)