Skip to main content

Importing Siyuan Old Docker Files to New Host

Step 1: Copy Old Siyuan Volume

First, copy the old Siyuan Docker volume from the previous host to the new host. You can use various methods like scp, rsync, or simply copying files via shared storage if available.

# Example using rsync
rsync -avz <old_host>:/path/to/old_siyuan_volume /path/to/new_host/new_siyuan_volume

Step 2: Run the Siyuan Container on New Host

Ensure Docker is installed and running on the new host. Start the Siyuan container using the copied volume.

docker run -d --name siyuan -v /path/to/new_siyuan_volume:/siyuan/workspace b3log/siyuan:v3.0.1

Step 3: Access Docker Container

Use docker ps to find the container ID or name on the new host.

docker ps

Step 4: Enter the Container and Replace Files

Access the Docker container using docker exec with /bin/sh and then switch to root user (su -).

docker exec -it <container_id_or_name> /bin/sh
su -

Step 5: Replace Old Files with New Files

Replace the entire /siyuan/workspace directory with the copied files from Step 1. Make sure the Siyuan container remains running throughout this process.

cp -R /path/to/new_siyuan_volume/* /siyuan/workspace/

Step 6: Change Ownership of Files

Change ownership of the /siyuan/workspace directory and its contents to siyuan:siyuan.

cd /siyuan/workspace
su -
chown -R siyuan:siyuan /siyuan/workspace

Step 7: Reboot Siyuan Container

Exit from the container shell and reboot the Siyuan container to apply the changes.

exit
docker restart siyuan

Step 8: Verify

Verify that Siyuan is running correctly with the imported files by accessing it through the web browser or the command line interface as needed.


This tutorial provides a structured approach to migrating Siyuan old Docker files to a new host, ensuring that all steps are executed correctly for seamless transition. Adjust paths and commands based on your specific environment and requirements.