Bobcares

Set Up Bitnami Moodle with Docker Compose in 10 Steps

by | Jul 19, 2024

Learn how to set up Bitnami Moodle with Docker Compose in 10 easy steps. Our Moodle Support team is here to help you with your questions and concerns.

How to Set Up Bitnami Moodle with Docker Compose

Are you ready to set up Moodle using Docker? Our Experts are here to help you out. Today, we will walk through getting Docker up and running to configuring and launching Moodle.
How to Set Up Bitnami Moodle with Docker Compose

1. Install Docker

First, check if we have Docker installed on our system. If not, we can download Docker from the official website.

2. Prepare Moodle Repository

Then, download Moodle or make sure we have a Git repository ready. We can use Docker Compose for this task.

3. Create a Docker Compose File

Now, we have to set up a container with the required technology to run and serve the Moodle source code. We’ll need a `docker-compose.yml` file to define the configuration for the containers. So, create this file in the project directory.

services:
mariadb:
image: 'mariadb:10'
container_name: db
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: moodle
MYSQL_USER: moodle
MYSQL_PASSWORD: moodlePassword
volumes:
- $HOME/volumes/mysql:/var/lib/mysql
moodle:
image: 'bitnami/moodle:3'
container_name: moodle
environment:
MOODLE_USERNAME: programster
MOODLE_PASSWORD: thisIsMyMoodleLoginPassword
MOODLE_EMAIL: admin@programster.org
MARIADB_HOST: db
MARIADB_PORT_NUMBER: 3306
MOODLE_DATABASE_USER: moodle
MOODLE_DATABASE_NAME: moodle
MOODLE_DATABASE_PASSWORD: moodlePassword
ALLOW_EMPTY_PASSWORD: "no"
ports:
- '80:80'
- '443:443'
volumes:
- $HOME/volumes/moodle:/bitnami'
depends_on:
- mariadb
volumes:
mariadb_data:
driver: local
moodle_data:
driver: local

4. Download Docker Images

Next, download the needed Docker images. Then, open a terminal and run these commands:

docker pull mariadb:10
docker pull bitnami/moodle:3

5. Configure the Database Service

Then, define a service for MariaDB in the `docker-compose.yml` file. Here’s the configuration:


services:
mariadb:
image: "bitnami/mariadb:10.1"
networks:
- moodle-net
environment:
- MARIADB_USER=bn_moodle
- MARIADB_DATABASE=bitnami_moodle
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- type: bind
source: /home/maria_data
target: /bitnami
ports:
- "3306:3306"

We have to make sure Docker can read/write the `/home/maria_data` folder on the host:

sudo chmod a+rwx /home/maria_data/

6. Configure the Moodle Service

Now, we will use a pre-built image for PHP and Apache:

docker pull webdevops/php-apache:7.3
docker run -d -p 80:80 efec3d223189

Then, go to `localhost` or the public IP address to see an empty Apache2 page. This confirms that the PHP & Apache image is running correctly.

7. Define the Docker Network and Volumes

Then, add these lines to the `docker-compose.yml` file:

networks:
moodle-net:
driver: bridge
volumes:
mariadb_data:
driver: local
moodle_data:
driver: local

8. Start the Containers

Now, it is time to start our containers with this command:

docker-compose up -d

9. Complete Moodle Installation

Then, go to `localhost` or our public IP address to start the Moodle installation process. We have to enter the database details specified in the MariaDB service configuration.

10. Verify Persistent Storage

After setting up Moodle, the host volumes/folders will be populated with data from the containers:

ls $HOME/volumes/moodle/

# Output: cache filedir lang localcache lock moodle muc sessions temp trashdir

ls /home/maria_data/mariadb/data/

# Output: aria_log.00000001 aria_log_control bitnami_moodle ibdata1 ib_logfile0 ib_logfile1 multi-master.info mysql mysql_upgrade_info performance_schema tc.log test

After the above steps, we have successfully set up Moodle using Docker. Now we can enjoy a fully functional Moodle instance backed by Docker containers.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to set up Bitnami Moodle with Docker Compose in 10 easy steps.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF