How do I properly update SiYuan on Docker?

Hi all SiYuan citizens! 👋

I need to know how to properly update SiYuan version on my Docker container.

I imagine I need to build it again... here's a basic step-by-step I think should work:

  1. Export all data (backup)
  2. Stop container
  3. Delete container
  4. Delete image
  5. Build anew
  6. Start container
  7. Upload backed up data

Is there a simpler way to do this?

    Solution
    • Macavity 1

      I don't think you need to export all data, you should of course have a backup - but it's unrelated to the update.

      When using docker-compose you have several shared folders like config and workspace - those contain your data.

      What I do:

      • down the container
      • pull the new image
      • build the new container
      • and "up" with it.

      Watchtower can do all of that for you.

    Welcome to here!

    Here we can learn from each other how to use SiYuan, give feedback and suggestions, and build SiYuan together.

    Signup About
    Please input reply content ...
    • glaucon1984 1 Up
      VIP Warrior

      I use Watchtower, it will automatically update all your containers:
      https://github.com/containrrr/watchtower

    • Macavity 1

      I don't think you need to export all data, you should of course have a backup - but it's unrelated to the update.

      When using docker-compose you have several shared folders like config and workspace - those contain your data.

      What I do:

      • down the container
      • pull the new image
      • build the new container
      • and "up" with it.

      Watchtower can do all of that for you.

    • DrEgg

      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!"