image installation

pull mirror

1
sudo docker pull b3log/siyuan

Create a catalog

1
sudo mkdir /mydata/siyuan

Installation and startup

Because the data directory in the image is /home/siyuan/Documents/SiYuan now the structure is not the same in the two directories and can not be started, so you need to:

  1. Create a temporary container, bind /mydata/siyuan

    1
    2
    sudo docker run -d --restart=always --name siyuan \
    -v /mydata/siyuan/Documents:/www/wwwroot/siyuan/workspace -p 6806:6806 b3log/siyuan
  2. Entering the container

    1
    sudo docker exec -it siyuan sh
  3. Copy out the data in the container/home/siyuan/Documents/SiYuan to /mydata/siyuan

    1
    cp -r /home/siyuan/Documents/SiYuan/ /www/wwwroot/siyuan/workspace/
  4. Check if there are any problems with the replication, and if not, delete the temporary container.

    1
    2
    3
    sudo docker ps -a # List the running containers and get the id of the temporary container.
    sudo docker stop d7ee2596218c # Stop the temporary container based on its id.
    sudo docker rm siyuan # Delete the temporary container.
  5. start

    1
    2
    sudo docker run -it -d --restart=always --name siyuan\
    -v /mydata/siyuan/Documents/SiYuan:/home/siyuan/Documents/SiYuan -p 6806:6806 b3log/siyuan
  6. fulfillment

SiYuan docker upgrade

1
2
3
4
5
6
sudo docker pull b3log/siyuan ## Pull the new docker
sudo docker stop siyuan ## Stop container
sudo docker rm siyuan ## Deleting containers
## Re-generating containers
sudo docker run -it -d --restart=always --name siyuan\
-v /mydata/siyuan/Documents/SiYuan:/home/siyuan/Documents/SiYuan -p 6806:6806 b3log/siyuan

data backup

1
2
3
4
5
6
7
8
9
10
## Method 1
In SiYuan's interface => Settings => Export => Export and that's it!

## Method II
docker stop siyuan ## Stop container
cd /mydata/siyuan/Documents/SiYuan ## Go to the SiYuan data folder
sudo tar -zcvf SiYuan.20230805.tar.gz ./SiYuan ## Pack the data into a zip archive (requires root privileges, otherwise the zip will fail)
docker start siyuan ## Launch Container

## Method 1 is simpler and the first method is recommended