Skip to main content

🗄️ Environment Variables

Every setting exposed by ruseler/alpine-moodle. Defaults come from the Dockerfile and are applied unless you override them in docker run, docker-compose.yml, or your orchestration tool.

Site​

VariableDefaultDescription
SITE_URLhttp://localhostPublic URL of the site. Becomes $CFG->wwwroot. Must match what users type in the browser.
MOODLE_SITENAMEDockerized_MoodleFull name shown on the Moodle front page.
MOODLE_LANGUAGEenInstaller language. Sets --lang on admin/cli/install.php.
LANGen_US.UTF-8System locale.
LANGUAGEen_US:enSystem language fallback chain.

Admin user​

VariableDefaultDescription
MOODLE_USERNAMEmoodleuserInitial admin username.
MOODLE_PASSWORDPLEASE_CHANGEMEInitial admin password. Always override.
MOODLE_EMAILuser@example.comAdmin email address.
warning

If the container finds an existing install, these values are re-applied to the admin user on every start via admin/cli/update_admin_user.php. Keep them in sync with your secret store.

Database — primary​

VariableDefaultDescription
DB_TYPEpgsqlpgsql, mariadb, mysqli or sqlite3.
MOODLE_DATABASE_TYPE(empty)Optional override for DB_TYPE. Set to sqlite3 to enable the single-container mode.
DB_HOSTpostgresDB hostname (service name on the Docker network).
DB_PORT54325432 for PostgreSQL, 3306 for MariaDB/MySQL.
DB_NAMEmoodleDatabase name.
DB_USERmoodleDatabase user.
DB_PASSmoodleDatabase password.
DB_PREFIXmdl_Table prefix. Must be non-numeric.
DB_SQLITE_PATH/var/www/moodledata/sqlite/moodle.sqliteSQLite file path. Must resolve inside /var/www/moodledata/.
DB_FETCHBUFFERSIZE(empty)Set to 0 when using PgBouncer in transaction mode.
DB_DBHANDLEOPTIONSfalseSet to true with PgBouncer (pool modes that reject SET options).

Database — read replica (optional)​

VariableDefaultDescription
DB_HOST_REPLICA(empty)Enables the read-only replica if set.
DB_PORT_REPLICA(empty)Falls back to DB_PORT.
DB_USER_REPLICA(empty)Falls back to DB_USER.
DB_PASS_REPLICA(empty)Falls back to DB_PASS.

Redis (optional)​

VariableDefaultDescription
REDIS_HOST(empty)When set, enables the Redis session handler and cache store.
REDIS_PASSWORD(empty)Redis password.
REDIS_USER(empty)Redis 6+ ACL user. Requires REDIS_PASSWORD or the container aborts at startup.

Reverse proxy / TLS​

VariableDefaultDescription
REVERSEPROXYfalseSet to true only if the site is intentionally served from multiple base URLs.
SSLPROXYfalseSet to true when a reverse proxy terminates TLS. Trusts X-Forwarded-Proto.
MY_CERTIFICATESnoneBase64-encoded trusted certificate bundle installed into the LDAP truststore (/etc/openldap/my-certificates/extra.pem). Use none to disable.

See Reverse Proxy for concrete examples.

Email / SMTP​

VariableDefaultDescription
SMTP_HOSTsmtp.gmail.comSMTP server hostname.
SMTP_PORT587SMTP server port.
SMTP_USERyour_email@gmail.comSMTP username.
SMTP_PASSWORDyour_passwordSMTP password.
SMTP_PROTOCOLtlstls, ssl or empty.
MOODLE_MAIL_NOREPLY_ADDRESSnoreply@localhostUsed as noreplyaddress.
MOODLE_MAIL_PREFIX[moodle]Email subject prefix.

PHP / web server tuning​

VariableDefaultDescription
client_max_body_size50MNginx max request body size.
post_max_size50MPHP post_max_size.
upload_max_filesize50MPHP upload_max_filesize.
max_input_vars5000PHP max_input_vars. Keep high for Moodle course imports.
memory_limit256MPHP memory_limit. Increase to 512M or more for big plugin installs / Moosh operations (#119).

Operational​

VariableDefaultDescription
AUTO_UPDATE_MOODLEtrueIf false, skip the automatic admin/cli/upgrade.php on container start.
RUN_CRON_TASKStrueSet to false to disable the internal runit-managed cron loop. Useful when you run cron externally.
DEBUGfalseWhen true, enables Moodle DEVELOPER debug level and debugdisplay.
PRE_CONFIGURE_COMMANDS(empty)Shell commands run before Moodle configuration.
POST_CONFIGURE_COMMANDS(empty)Shell commands run after Moodle configuration (great for Moosh).

Build-time argument​

Build ARGDefaultDescription
MOODLE_VERSIONmainUpstream Moodle tag to install (e.g. v5.0.2, v4.5.7). main installs the current development branch.

Full list of available Moodle tags: https://github.com/moodle/moodle/tags


This documentation is a fork of erseco/alpine-moodle. The upstream documentation is available here.