Site icon 咖啡偶-IT日常

moodle 升級(docker)

去年安裝了moodle想要當作公司知識管理,沒多久就遇到資安問題,系統需要升級。
可是 moodle 網站 對於升級並沒有太多說明;反而有點誤導,似乎只要容器(container)更新到最新即可自動更新。
其實不是的
必須:
1、先在舊版容器進入維護模式,下載最新版程式,並且更新到最新更新後離開維護模式
2、停用已升級完畢舊版容器
3、改用最新的images(套用原先的volume資料)
4、刪除舊容器
以下紀錄相關作法:

docker exec -it <container name> bash
apt update
apt install wget
wget --no-check-certificate https://download.moodle.org/download.php/direct/stable401/moodle-4.1.10.zip
#請注意/bitnami/moodledata 必須連到對應為volume
/bin/cp -R /bitnami/moodle /bitnami/moodledata
rm -rf /bitnami/moodle/*
apt install unzip
unzip xxx.zip
/bin/cp -R moodle/* /bitnami/moodle
Step 1: Get the updated image
$ docker pull bitnami/moodle:latest

Step 2: Stop the running container
Stop the currently running container using the command
#這部分有時候會停用失敗,請用docker stop 方式直接停用container
$ docker-compose stop moodle

Step 3: Take a snapshot of the application state
Backup your container 要備分(我之前有做了)

Step 4: Remove the currently running container
Remove the currently running container by executing the following command:
docker-compose rm -v moodle

Step 5: Run the new image (修改yml裡面moodle版本->到最新)
Update the image tag in docker-compose.yml and re-create your container with the new image

$ docker-compose up -d
Exit mobile version