使用Docker搭建Syncthing

Syncthing 官网:https://syncthing.net/

在服务器上部署 Docker
Debian 安装 Docker:https://docs.docker.com/engine/install/debian/

Ubuntu 安装 Docker:https://docs.docker.com/engine/install/ubuntu/

拉取 syncthing 镜像

docker pull syncthing/syncthing

运行容器
docker run -d -p 8384:8384 -p 22000:22000 -v /data/syncthing:/var/syncthing --restart=always syncthing/syncthing:latest

参数解释:

-d:后台运行
-p 8384:8384: 暴露 8384 端口,8384 是 Web 界面端口
-p 22000:22000:暴露 22000 端口,22000 是通讯端口
-v /data/syncthing:/var/syncthing:映射文件夹,将备份的文件映射至宿主机的/data/syncthing 目录下
–restart=always:容器随着 Docker 的启动而启动
syncthing/syncthing:latest:镜像版本

如果你购买的服务器有控制面板,需要在控制面板开放8384(TCP)和22000(TCP 和 UDP 都要开)

至此,syncthing 已经部署到了服务器上,下一步我们只需要在本地也启动一个 syncthing,与服务器进行实时同步即可。

syncthing 下载地址:https://syncthing.net/downloads/

 

Tagged on: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.