version: '3.8' services: mariadb: image: mariadb:11.3 restart: always env_file: - ./.env volumes: - mariadb_data:/var/lib/mysql ports: - 3306:3306 networks: - network # Adding the network communication between containers environment: - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} - MOODLE_DATABASE_USER=${MOODLE_DATABASE_USER} - MOODLE_DATABASE_PASSWORD=${MOODLE_DATABASE_PASSWORD} moodle: env_file: - ./.env restart: always build: # Building own Moodle container from Dockerfile. context: . # The context of the build (where is Dockerfile) dockerfile: Dockerfile args: - MOODLE_BASE_DIR=${MOODLE_BASE_DIR} - MOODLE_BASE_DIR_DATA=${MOODLE_BASE_DIR_DATA} - MOODLE_DATABASE_TYPE=mariadb - MOODLE_DATABASE_HOST=${MOODLE_DATABASE_HOST} - MOODLE_DATABASE_NAME=${MOODLE_DATABASE_NAME} - MOODLE_DATABASE_USER=${MOODLE_DATABASE_USER} - MOODLE_DATABASE_PASSWORD=${MOODLE_DATABASE_PASSWORD} ports: - 80:80 - 443:443 - 5000:5000 dns: - 8.8.8.8 - 8.8.4.4 depends_on: # Dependency from MariaDB service - mariadb volumes: - ${PWD}/asystgrade:${MOODLE_BASE_DIR}/local/asystgrade # Sync the plugin folder with the container - moodle_data:${MOODLE_BASE_DIR} # Volume for Moodle - moodledata:${MOODLE_BASE_DIR_DATA} # Volume for Moodle data networks: - network # Adding the network communication between containers volumes: # Defining local volumes moodledata: driver: local mariadb_data: driver: local moodle_data: driver: local asystgrade: driver: local networks: network: # Creating a network