Bitnami provide docker image for Moodle and it can be found in https://hub.docker.com/r/bitnami/moodle. In fact Bitnami provides a variety of Docker images, but I am not that familiar with this company. It looks solid though. docker-compose.yml file can be downloaded from their repository on GitHub. https://github.com/bitnami/containers/tree/main/bitnami/moodle
You can copy docker compose yaml file and starts container out of it. docker-compose.yml file looks like below and Dockerfile is not needed since all Docker images are pulled from Docker hub.
# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0
services:
mariadb:
image: docker.io/bitnami/mariadb:latest
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_USER=bn_moodle
- MARIADB_DATABASE=bitnami_moodle
- MARIADB_CHARACTER_SET=utf8mb4
- MARIADB_COLLATE=utf8mb4_unicode_ci
volumes:
- 'mariadb_data:/bitnami/mariadb'
moodle:
image: docker.io/bitnami/moodle:4.5
ports:
- '80:8080'
- '443:8443'
environment:
- MOODLE_DATABASE_HOST=mariadb
- MOODLE_DATABASE_PORT_NUMBER=3306
- MOODLE_DATABASE_USER=bn_moodle
- MOODLE_DATABASE_NAME=bitnami_moodle
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- 'moodle_data:/bitnami/moodle'
- 'moodledata_data:/bitnami/moodledata'
depends_on:
- mariadb
volumes:
mariadb_data:
driver: local
moodle_data:
driver: local
moodledata_data:
driver: local
Once docker-compose.yml file is saved. You can start the container by typing.
docker compose up -d
When Moodle site starts, you can login by using credentials of user for user name and bitnami for password. Your Moodle will be hosted in your local machine on port 80. It can be accessed by http://localhost.