Moodle with container plugin install support via docker -e. Red Hat/CentOS SCL. s6 Overlay.
10K+
Supported tags and respective Dockerfile links
Depreciatedbuilds are not recommended, as they are EOL.NOTICE: The container overhaul to CentOS changes the location of
moodledata. It is now located in/var/moodledata. Please update persistent mounts if upgrading. This is as of theMOODLE_37_STABLEbuild. Depreciated builds (3.4.1+ and below) use/var/www/moodledata.
MOODLE_38_STABLE, latest (MOODLE_38_STABLE/Dockerfile)MOODLE_37_STABLE (MOODLE_37_STABLE/Dockerfile)3.4.1 (3.4.1/Dockerfile)3.3.4 (3.3.4/Dockerfile)3.0.10 (3.0.10/Dockerfile)Now with plugin support via docker -e!
Example: To startup a super basic, unconfigured local install with default values, no ssl.
Create a docker network moodle-network
docker network create moodle-network
Start a postgres server instance from the official postgres repository
| If mysql is desired, use the 2nd example further below.
docker run --rm -d --name moodle-postgres \
--network moodle-network \
--env POSTGRES_USER=moodle \
--env POSTGRES_PASSWORD=moodle \
--env POSTGRES_DB=moodle \
postgres:11.4
Then start a venatorfox/moodle instance, expose port 80.
docker run --rm -d --name some-moodle \
--network moodle-network \
--env MOODLE_WWWROOT=http://localhost \
--publish 80:80 \
venatorfox/moodle:MOODLE_38_STABLE
Example: Same thing as above, but for mySQL instead of Postgres. Postgres is however recommended as per Moodle docs. Please note that brand new installs of MySQL 8 will require a workaround to avoid authentication issues. Upgrades from MySQL 5 to 8 carries over the workaround.
Create a docker network moodle-network
docker network create moodle-network
docker run --rm -d --name moodle-mysql \
--network moodle-network \
--env MYSQL_ROOT_PASSWORD=moodle \
--env MYSQL_USER=moodle \
--env MYSQL_PASSWORD=moodle -env \
--MYSQL_DATABASE=moodle \
mysql:5.7.27
Then start a venatorfox/moodle instance, change dbtype settings, expose port 80.
docker run --rm -d --name some-moodle \
--network moodle-network \
--env MOODLE_WWWROOT=http://localhost \
--env MOODLE_DBTYPE=mysqli \
--env MOODLE_DBHOST=moodle-mysql \
--env MOODLE_DBPORT=3306 \
--publish 80:80 \
venatorfox/moodle:MOODLE_38_STABLE
If this is a new db install, grab some covfefe and wait until the webserver starts (indicated by [services.d] done in the log).
Visit the site at Visit the site at http://localhost, default username (if nothing was configured via --env) is "admin" and password "password". #superSecure
See below for available runtime environment variables for a more specific configuration, such as plugin installation.
Volumes should be mounted for the moodledata and the database for persistant storage. The moodledata directory is located at /var/moodledata. Please remember to do this so no data loss occurs! The container should be pulled and re-created as version updates from Moodle occur often.
The Moodle config.php will be created at run and baked into the Moodle Core Install. Like all of the other Moodle files, the config.php will be ephemeral, please do not edit it directly. Should changes be made, simply destroy the container and run it again with the desired runtime environment variables.
All customizations can be done via the following environment variables. It is recommended to set them properly and not use default values. (Unless you want limits at 1M & no SSL, with your admin password being password (Can you not, kthx)).
Ephemeral variables can be changed on existing installations via container rebuild as they are in the moodle container and have no relation to the database.
| Variable | Default Value | Description | Ephemeral |
|---|---|---|---|
| NGINX_MAX_BODY_SIZE | 1M | Maximum allowed body size for NGINX | TRUE |
| NGINX_KEEPALIVE_TIMEOUT | 65 | View the NGINX docs for more information | TRUE |
| NGINX_SSL_SESSION_CACHE | none | This container is designed to have some SSL proxy/LB put in front of it on 80. Internal SSL can however still be tuned if snakeoil 443 is desired for whatever reason. NGINX docs | TRUE |
| NGINX_SSL_SESSION_TIMEOUT | 5m | NGINX docs | TRUE |
| PHPFPM_UPLOAD_MAX_FILESIZE | 2M | Maximum allowed upload filesize for PHP-FPM | TRUE |
| PHPFPM_POST_MAX_SIZE | 8M | Maximum size of post data allowed for PHP-FPM | TRUE |
| PHPFPM_MAX_EXECUTION_TIME | 30 | Maximum execution time for php scripts | TRUE |
| PHPFPM_OPCACHE_MEMORY_CONSUMPTION | 128 | View the Moodle OPcache docs for more information | TRUE |
| PHPFPM_OPCACHE_MAX_ACCELERATED_FILES | 4000 | View the Moodle OPcache docs for more information | TRUE |
| CRON_MOODLE_INTERVAL | 15 | Interval for Moodle Cron in Minutes | TRUE |
| MOODLECFG_SSLPROXY | false | Set to true if an SSL proxy container is put infront of the Moodle install, such as HAProxy with SSL termination; An example will be presented in the below docker compose files | TRUE |
| MOODLE_LANG | en | ------ | FALSE |
| MOODLE_WWWROOT | http://localhost | Use https:// any type of SSL solution | TRUE |
| MOODLE_DATAROOT | /var/moodledata | This is internal, it should never change from the default value /var/moodledata. | TRUE |
| MOODLE_DBTYPE | pgsql | Change to mysqli if using MySQL | FALSE |
| MOODLE_DBHOST | moodle-postgres | Change to something like moodle-mysql if using MySQL | FALSE |
| MOODLE_DBNAME | moodle | ------ | TRUE |
| MOODLE_DBUSER | moodle | ------ | TRUE |
| MOODLE_DBPASS | moodle | ------ | TRUE |
| MOODLE_DBPORT | 5432 | Change to 3306 if using MySQL | TRUE |
| MOODLE_PREFIX | mdl_ | ------ | FALSE |
| MOODLE_FULLNAME | Some Moodle Site Full Name | ------ | FALSE |
| MOODLE_SHORTNAME | Some Moodle Site Short Name | ------ | FALSE |
| MOODLE_SUMMARY | Some Moodle Summary | ------ | FALSE |
| MOODLE_ADMINUSER | admin | ------ | FALSE |
| MOODLE_ADMINPASS | password | ------ | FALSE |
| MOODLE_ADMINEMAIL | [email protected] | ------ | FALSE |
| MOODLECFG_TEMPDIR | $MOODLE_DATAROOT/temp | Generally should not be changed from the default value. This must be common in a clustered deployment. View the Moodle Server cluster docs for more information | TRUE |
| MOODLECFG_CACHEDIR | $MOODLE_DATAROOT/cache | Generally should not be changed from the default value. This must be common in a clustered deployment. View the Moodle Server cluster docs for more information | TRUE |
| MOODLECFG_LOCALCACHEDIR | $MOODLE_DATAROOT/localcache | Generally should not be changed from the default value. Does not need to be common in a clustered deployment. Point towards fast storage. View the Moodle Server cluster docs for more information | TRUE |
| MOODLECFG_REVERSEPROXY | false | Set to true if the container is accessed via different base URL, This will prevent redirection loop if the container behind a proxy which strips the url | TRUE |
| MOODLECFG_SESSION_HANDLER_CLASS | file | Change the session handler. Valid values are file, memcached, or redis. View the Moodle Session handling docs for more information | TRUE |
| MOODLECFG_SESSION_MEMCACHED_SAVE_PATH | some-memcached:11211 | Ignored if session handling is not memcached | TRUE |
| MOODLECFG_SESSION_MEMCACHED_PREFIX | memc.sess.key | Ignored if session handling is not memcached | TRUE |
| MOODLECFG_SESSION_MEMCACHED_ACQUIRE_LOCK_TIMEOUT | 120 | Ignored if session handling is not memcached | TRUE |
| MOODLECFG_SESSION_REDIS_HOST | some-redis | Ignored if session handling is not redis | TRUE |
| MOODLECFG_SESSION_REDIS_PORT | 6379 | Ignored if session handling is not redis | TRUE |
| MOODLECFG_SESSION_REDIS_DATABASE | 0 | Ignored if session handling is not redis | TRUE |
| MOODLECFG_SESSION_REDIS_PREFIX | Ignored if session handling is not redis | TRUE | |
| MOODLECFG_SESSION_REDIS_ACQUIRE_LOCK_TIMEOUT | 120 | Ignored if session handling is not redis | TRUE |
| MOODLECFG_SESSION_REDIS_LOCK_EXPIRE | 7200 | Ignored if session handling is not redis | TRUE |
| INSTALL_PLUGIN_URLS | Enter a list of plugin URLS, seperated by spaces. As URL's often change with new versions hosted by Moodle, it is recommended to download from Moodle and host internally to ensure they stay available. Do NOT change the basename of the URL or filename if doing this. | TRUE |
Some more complex (ie. with SSL termination, Plugins, etc...) setup examples are located in the README.md within the examples directory.
NOTE: Clustered deployments must have an existing install (database). If a new install, start with 1 replica, and then increase after the install. If you don't do this, multiple replicas will try to install Moodle simultaneously into the same database which will not result in a good time. Recommended to read the Moodle Server cluster docs before deploying this in any clustered/orchestrated solution such as K8's.
Please Create an issue if needed.
Content type
Image
Digest
Size
315.7 MB
Last updated
over 6 years ago
docker pull venatorfox/moodle