Dockerfile Cookbook Recipes Attempt 1: moodle (failure)
In this guide we go over the first attempt at rolling your own moodle container.
![Dockerfile Cookbook Recipes Attempt 1: moodle (failure)](/content/images/size/w2000/2024/06/image2443-2.png)
- Moodle is considered the defacto educational test taking / building system.
We will attempt the most basic build and from that look at security basics.
Step 1: Make a moodle install point
- Make a directory /moodle
- Inside it we will build a moodle source point.
mkdir moodle
cd moodle
git clone https://github.com/moodle/moodle.git
chown -R www-data:root moodle
Step 2: Running a moodle instance (diagnostic testing)
- Is built off of calling a php image and giving it a -v point that matches where moodle is installed, thus:
docker run -it -v /moodle/moodle:/var/www/html -p 8080:80 --name moodle php:apache
It will show up as:
http://<external ip>:8080/install.php
A basic install serial:
![](https://www.hotconfig.com/content/images/2024/06/image-77.png)
![](https://www.hotconfig.com/content/images/2024/06/image-78.png)
The installer is pretty comprehensive (and forgiving) it will guide you if you need to change a permission.
![](https://www.hotconfig.com/content/images/2024/06/image-79.png)
- Moodle is used to having it's own server, but we have containerized it using the -v option to map its directory to the moodle directory
To fix this we need to get into the running container itself
chown -R www-data:root www
It supports the following drivers:
![](https://www.hotconfig.com/content/images/2024/06/image-80.png)
![](https://www.hotconfig.com/content/images/2024/06/image-81.png)
![](https://www.hotconfig.com/content/images/2024/06/image-82.png)
- We can see at this point we need to go back and build a modified Dockerfile - which has the PDO / database objects as it was not native to the container.