0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Moodle(on Docker)のDB,moodle,moodle_dataを永続化する。

Last updated at Posted at 2022-07-12

bitnami/moodleの記載だけだと少しだけ躓いたのでメモ。

docker-compose.ymlを取得する。

curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/moodle/docker-compose.yml > docker-compose.yml

docker-compose.yml

自動起動するように設定しておく。1

docker-compose.yml
version: '2'
services:
  mariadb:
    image: docker.io/bitnami/mariadb:11.1
    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'
    restart: always
  moodle:
    image: docker.io/bitnami/moodle:4
    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
      - MOODLE_REVERSEPROXY=no
      - PHP_MAX_EXECUTION_TIME=600
      - PHP_POST_MAX_SIZE=24M
      - PHP_UPLOAD_MAX_FILESIZE=24M
    volumes:
      - 'moodle_data:/bitnami/moodle'
      - 'moodledata_data:/bitnami/moodledata'
    depends_on:
      - mariadb
    restart: always
build:
  context: .
  dockerfile: Dockerfile
  args:
    - EXTRA_LOCALES=ja_JP.UTF-8 UTF-8
volumes:
  mariadb_data:
    driver: local
  moodle_data:
    driver: local
  moodledata_data:
    driver: local

(参考)[https://github.com/bitnami/containers/blob/main/bitnami/moodle/docker-compose.yml]
結局volumeを素直に使うのがよいようだ。
volumeからファイルを抽出するときはdocker cpを使用する。

  1. docker-composeでOS起動時にコンテナを自動起動する方法

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?