Sign inSign up

ireina/syncthing

By ireina

•Updated over 2 years ago

A syncthing docker which is allowed to specify config directory and data directory.

Image
0

2.2K

ireina/syncthing repository overview

Dockerfile

FROM alpine

WORKDIR /syncthing

RUN apk update && apk add --no-cache\
	syncthing

VOLUME ["/syncthing"]

ENTRYPOINT [""]
CMD ["syncthing", "serve", "--home=/syncthing/config", "--gui-address=[::]:8384", "--no-default-folder"]

root@debian:~/docker# cat Dockerfile 
FROM alpine

WORKDIR /syncthing

ARG SYNCTHING=v1.27.3

VOLUME ["/syncthing"]

RUN wget https://github.com/syncthing/syncthing/releases/download/$SYNCTHING/syncthing-linux-amd64-$SYNCTHING.tar.gz && \
    tar xzvf syncthing-linux-amd64-$SYNCTHING.tar.gz && \
    mv syncthing-linux-amd64-$SYNCTHING/syncthing /usr/bin && \
    rm -rf syncthing-linux-amd64-$SYNCTHING.tar.gz syncthing-linux-amd64-$SYNCTHING

ENTRYPOINT [""]

CMD ["syncthing", "serve", "--home=/syncthing/config", "--gui-address=[::]:8384", "--no-default-folder"]

⁠1. 准备

先准备目录,目录结构如下

syncthing/
├── config
│   ├── https-cert.pem
│   └── https-key.pem
└── data

syncthing 目录下有 config 和 data 目录,这三个目录是必须的,其余可以不用创建。

config 存放 syncthing 程序的配置文件,https-cert.pem 和 https-key.pem 是网页端面板用到的证书,如果你有域名和该域名的证书、私钥,可以提前放入,并更名;如果没有则留空,syncthing 会自己创建,但公网访问管理界面时使用 https,浏览器会报证书错误,而公网访问使用 http 时又不能提供加密。

⁠2. 运行容器
docker run \
	-itd \
	--restart unless-stopped \
	--name syncthing-alpine \
	--network host \
	--user 1000:1000 \                        # 改成你希望的 uid 和 gid
	-v /{your path to save config and data}/syncthing:/syncthing \
	ireina/syncthing

Tag summary

Content type

Image

Digest

sha256:5ec8c20c3…

Size

13.3 MB

Last updated

over 2 years ago

docker pull ireina/syncthing