Public | Automated Build

Last pushed: a year ago
Short Description
Moodle LMS container for use with a external database container
Full Description

docker-moodle

A Dockerfile that installs and runs the latest Moodle stable.

Installation

git clone https://github.com/jda/docker-moodle
cd docker-moodle
docker build -t moodle .

Usage

To spawn a new instance of Moodle:

docker run -d --name DB -p 3306:3306 -e MYSQL_DATABASE=moodle -e MYSQL_USER=moodle -e MYSQL_PASSWORD=moodle centurylink/mysql
docker run -d -P --name moodle --link DB:DB -e MOODLE_URL=http://192.168.59.103:8080 -p 8080:80 jauer/moodle

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

http://192.168.59.103:8080

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 reductionist take on sergiogomez's docker-moodle Dockerfile.

Docker Pull Command
Owner
jauer
Source Repository

Comments (8)
bb14521
2 years ago

can you install VPL-jailserver wiith that docker image

teamnigeria
2 years ago

I saw it pulled from Ubuntu I'm running centos7 will it still work ? guess I will find out.

lrkwz
2 years ago

I've defined a docker-compose.yaml

db:
image: mysql
ports:

    - 3306:3306
environment:
    MYSQL_DATABASE: moodle
    MYSQL_ROOT_PASSWORD: root
    MYSQL_USER: moodle
    MYSQL_PASSWORD: moodle

moodle:
image: jauer/moodle
ports:

    - 8080:80
links:
    - db:DB
environment:
  MOODLE_URL: http://172.16.0.21:8080

I bring up both the containers with

docker-compose up -d

but when I browse to http://172.16.0.21:8080/, after the first welcome screen, I get redirected to a

Error reading from database

It is usually not possible to recover from errors triggered during installation, you may need to create a new database or use a different database prefix if you want to retry the installation.

How should I solve this?

nicus
2 years ago

If not interested in sending email, but stop moodle hanging when it tries to send one, just add the following, to moodle-config.php:

$CFG->noemailever = true;

demaniak
2 years ago

Moodle "hung" when ever it hit a point where email had to be sent.

To fix, get a bash shell into the running container.
run postfix check and correct whatever it finds.

Then run killall postdrop

THEN edit /etc/postfix/main.cf, and add the line setgid_group = postdrop somewhere (I added about mid file).

Restart postfix (I had to manually kill postfix and then start it again).

After that - everything worked like a charm

funkaster
3 years ago

Thanks! This is what I did to get this running with an already existing mysql container:

docker run -d --name test-moodle --link wp-mysql:DB -e DB_ENV_MYSQL_DATABASE="moodle" -e DB_ENV_MYSQL_USER="moodle" -e DB_ENV_MYSQL_PASSWORD="moodle" -e MOODLE_URL="http://moodle.mariapazu.com" moodle

Of course, that required to have the moodle user, database & permissions created on the mysql container (I'm using the official mysql container)

bkone
3 years ago

Thanks for putting this image together. Very helpful!!

bkone
3 years ago

Here are my steps to get a persistent mysql data setup and link moodle container to the mysql DB

docker run -i -t --name mysql_data -v /var/lib/mysql busybox

docker run --name mysql -d -p 3306:3306 --volumes-from mysql_data -e MYSQL_DATABASE=moodle -e MYSQL_USER=moodle -e MYSQL_PASSWORD=moodle centurylink/mysql

docker run -d -P --name moodle --link mysql:DB -e MOODLE_URL=http://192.168.59.103:8080 -p 8080:80 jauer/moodle