Syncthing Docker Compose Builder
Build a compose.yaml for Syncthing. Choose host or bridge networking, the GUI address, user and group, storage, and extra folders, and get a file with a matching health check.
Input
Output
- The data folder and the folders you add must be writable by the user and group above.
Readme
What is Syncthing?
Syncthing is an open source program that keeps folders in sync between your devices, directly and without a central server. The project provides an official image, syncthing/syncthing, whose web GUI listens on port 8384 and whose sync protocol uses port 22000 for TCP and QUIC. Devices on the same network find each other with broadcasts on port 21027.
Tool description
This tool builds a compose.yaml for Syncthing that follows the Docker README of the project. By default it uses host networking, which the README recommends, because Syncthing can then see the devices on your local network. In this mode the tool unsets STGUIADDRESS, so the GUI listens on the address from the Syncthing settings, which is 127.0.0.1:8384 by default. You can also pick bridge mode. The tool then publishes the GUI port, the sync port for TCP and UDP, and the discovery port, and warns about what bridge mode costs. You set the hostname, the user and group with PUID and PGID, an optional UMASK and PCAP, the data folder, and more folders from the host. A health check that follows the GUI address is added. Everything is created in your browser.
Features
- Host networking as recommended, or bridge mode with the ports 8384, 22000/tcp, 22000/udp, and 21027/udp published
- The GUI listen address in host mode, with a warning when it can be reached from other machines
- A bind address for the GUI port in bridge mode, such as
127.0.0.1 PUID,PGID,UMASK, andPCAP, and a hostname for the device name- A data folder on the host or a named Docker volume, which is declared for you
- More folders to synchronize, each optionally read only
- The health check from the README, adjusted to the port and address of the GUI
- Any other environment variable, comments that explain the file, and a download as
compose.yaml
Examples
The default settings give the example from the Syncthing Docker README:
services:
syncthing:
image: syncthing/syncthing
container_name: syncthing
hostname: syncthing
network_mode: host
environment:
PUID: "1000"
PGID: "1000"
STGUIADDRESS: ""
volumes:
- ./st-sync:/var/syncthing
healthcheck:
test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1
interval: 1m
timeout: 10s
retries: 3
restart: unless-stoppedTips
- Save the result as
compose.yamland start it withdocker compose up -d. Then openhttp://127.0.0.1:8384 - Docker's default bridge mode hides the local addresses of your devices, so they connect slowly or through relays. Use host mode when you can
- The image listens on
0.0.0.0:8384by default. That is why host mode unsetsSTGUIADDRESS, and why bridge mode should bind the published GUI port to127.0.0.1unless you want to reach it from other machines - When the GUI can be reached from other machines, set a GUI password and enable TLS in the Syncthing settings
- The data folder and the folders you add must be writable by
PUIDandPGID - Folders you add here appear in Syncthing under the path in the container, so choose that path when you add the folder in the GUI
- The sync port stays 22000, because Syncthing tells other devices to connect to that port