DrEgg
Follow
#2087 2024-07-12 21:14:50 Join
76
Home View
15m29s
Online time
  • How do I properly update SiYuan on Docker?

    2024-10-31 04:26

    A bit too late to the party

    I wrote a bash script to automate it. What the script does is

    1. pull the latest image
    2. stop the current container
    3. remove the current contianer
    4. create a new container with latest image

    All your data is on local hard drive so you don't have to backup.

    #!/bin/bash
    
    if [ `id -u` -ne 0 ]
            then echo "[ERROR] Run in sudo!"
            exit
    fi
    
    read -p "note password: " accessword
    if [ -z "${accessword}" ]; then
            accessword="DefaultPasswd"
    fi
    printf "\nYour password is:\n ${accessword}]\n\n"
    
    echo "[pull] pulling latest image"
    docker pull b3log/siyuan > /dev/null
    echo "[pull] done!"
    echo "[stop] stopping container"
    docker stop siyuan > /dev/null
    echo "[stop] done!"
    echo "[rm] removing container"
    docker rm siyuan > /dev/null
    echo "[rm] done!"
    echo "[start] starting container"
    docker run -d -v /srv/siyuan:/srv/siyuan -p 8088:6806 --name siyuan -u 1000:1000 -t b3log/siyuan --workspace=/path/to/siyuan/root --accessAuthCode="$accessword" > /dev/null
    echo "[start] done!"