Install Docker: First, you need to install docker on your machine.
Get the Moodle image: Once Docker is installed, you can get the official Moodle image from the Docker Hub. You can pull the image using the following command:
docker pull moodlehq/moodle-php-apache:latest
This command will download the latest version of the Moodle image.
Create a Docker volume: You need to create a Docker volume to store the Moodle data. You can create a volume using the following command:
docker volume create moodledata
This will create a volume named moodledata that you can use to store your Moodle data.
Start the Moodle container: You can start the Moodle container using the following command:
docker run --name moodle -p 80:80 -v moodledata:/var/www/html -d moodlehq/moodle-php-apache:latest
This command will start a new container named moodle, bind port 80 of the container to port 80 of the host machine, mount the moodledata volume to the /var/www/html directory in the container, and run the latest version of the Moodle image in detached mode.
Access Moodle: You can access Moodle by visiting http://localhost in your web browser.
That’s it! You now have Moodle running in a Docker container.