Syncthing is an open-source continuous file synchronization tool for moving files directly between devices you control. Self-hosting Syncthing with Docker gives you a private alternative to putting every working folder into a large cloud-storage account, while still keeping changes synchronized across a laptop, desktop, home server, or small office.
This guide walks through a practical Docker deployment, adding devices and folders, choosing the right network mode, protecting the web GUI, handling versioning and backups, and upgrading safely. It follows Syncthing’s official Docker guidance, which recommends host networking for reliable local discovery and notes that the container runs as UID 1000 and GID 1000 by default. Synchronization is not the same as backup: a deleted or encrypted file can be propagated to every peer, so you need both a sync plan and a backup plan.
What Syncthing does and does not do
Syncthing synchronizes files between two or more devices. It is not a central cloud drive and does not require a permanent third-party server holding a copy of your data. Devices establish authenticated connections and exchange changes. You can synchronize a project directory between a workstation and a home server, keep selected documents available on a laptop, or replicate a folder between two locations.
That model has useful privacy properties, but it changes the operational risks. If every peer is online and a file is deleted, the deletion may propagate. If ransomware encrypts a shared folder, encrypted files may synchronize too. Use read-only folder permissions where appropriate, enable file versioning for important folders, and keep an independent backup such as the Restic homelab backup setup.
Syncthing also does not replace a shared filesystem. It is designed for eventual synchronization, not simultaneous database writes or applications that expect a single lock authority. Do not sync live PostgreSQL data directories, VM disk images, or application databases between active hosts unless the application explicitly supports that arrangement.
Prepare the host and data paths
Use a Linux host with Docker Engine and Compose v2. Give Syncthing a stable hostname or LAN address, reliable storage, and enough disk for the folders plus temporary file transfers. The official image uses /var/syncthing for its configuration and synchronized data by default.
Create a dedicated directory and decide which host folders will be synchronized:
sudo mkdir -p /opt/syncthing/data
sudo mkdir -p /srv/sync
sudo chown -R "$USER":"$USER" /opt/syncthing /srv/sync
cd /opt/syncthing
The container process commonly runs with UID 1000 and GID 1000. Check the ownership of /srv/sync and confirm that the numeric IDs match the user who should own the files. If your host uses different IDs, set PUID and PGID explicitly and make the directory ownership consistent. Do not solve a permissions problem by running the container as root without understanding the consequences.
Keep the synchronized folders outside the application configuration directory when possible. This makes it clearer which data is application state and which data is user content, and it lets you back up the two categories differently.
Run Syncthing with Docker Compose
The official Syncthing Docker instructions recommend host networking because Docker’s default bridge network can prevent peers from discovering useful local IP addresses. Host networking also means Syncthing controls the interfaces and ports directly, so review its listen addresses and firewall rules rather than assuming Docker is hiding them.
Create compose.yml:
services:
syncthing:
image: syncthing/syncthing:latest
container_name: syncthing
hostname: home-server
environment:
- PUID=1000
- PGID=1000
- UMASK=002
- STGUIADDRESS=127.0.0.1:8384
volumes:
- /opt/syncthing/data:/var/syncthing
- /srv/sync:/srv/sync
network_mode: host
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -fkLsS -m 2 http://127.0.0.1:8384/rest/noauth/health | grep -q OK"]
interval: 1m
timeout: 10s
retries: 3
The official example uses the Syncthing image, host networking, /var/syncthing, and a health check. Pin a tested image tag for a production server instead of relying on latest forever. Check the current project release page before selecting a version; the example tag above is intentionally easy to understand but should be replaced with the release you have tested.
The STGUIADDRESS setting limits the web interface to loopback. With host networking, the GUI would otherwise need its own access controls and firewall policy. If you plan to put the GUI behind a reverse proxy, keeping it on 127.0.0.1:8384 makes the public exposure boundary explicit.
Start the service:
docker compose pull
docker compose up -d
docker compose ps
docker compose logs --tail=100 syncthing
Open the GUI locally with an SSH tunnel when you are configuring the first device:
ssh -L 8384:127.0.0.1:8384 user@sync-host
Then browse to http://127.0.0.1:8384. The first-run wizard will ask you to set a GUI username and password. Do that before making the interface reachable from another network.
Add devices and folders
Every Syncthing installation has a device identifier. On the server, open Actions, choose Show ID, and add that ID on your laptop or desktop. The other device will show a pending connection request; accept it only when the displayed identity and device name match the device you intended to pair.
After the devices are paired, share a folder. You can create a folder from the GUI or use a directory under /srv/sync:
sudo mkdir -p /srv/sync/documents
sudo chown -R 1000:1000 /srv/sync/documents
Choose a stable folder ID and a descriptive label. Select the remote device, then decide whether each side is Send & Receive, Send Only, or Receive Only. A home server receiving laptop backups can use Receive Only on the server if the workflow is one-way. For a working folder that changes on both devices, Send & Receive is appropriate, but it carries the deletion and conflict risks described earlier.
Start with a small test folder containing a few files. Confirm that a new file arrives, a modification propagates, and a deliberate rename behaves as expected. Check file ownership and permissions on both sides before sharing a large directory.
Do not synchronize directories with constantly changing internal state such as .git object stores between unrelated workflows, browser profiles, password-manager live databases, or Docker volumes for running services. For application data, use the application’s export or backup mechanism instead.
Make discovery and connectivity reliable
Syncthing can use local discovery, global discovery, relays, and direct connections. Host networking helps local discovery in Docker. On a LAN, allow the Syncthing discovery and transfer traffic between the devices according to the current documentation and your firewall policy. Do not open every port just to make a first test work.
A direct connection is usually faster than a relay. If two devices are on separate networks, a VPN such as Tailscale can give them a private route without exposing Syncthing’s transfer port publicly. The Tailscale remote-access guide covers the private-network side, but Syncthing still needs to be configured and authenticated on each peer.
If you use a firewall, allow only the required interfaces and networks. The GUI should be reachable from an administrator network, not from the entire internet. Syncthing’s data transfer and local discovery settings are separate from GUI access; restricting the GUI does not automatically block file transfers, and blocking transfer traffic does not secure the GUI.
Protect the web GUI
The Syncthing Docker README notes that the GUI should have authentication and TLS when configured for external access. The safest default is to keep it on loopback and reach it through SSH or a VPN. If you need a hostname, put it behind an HTTPS reverse proxy and an additional access policy.
For example, a Caddy site can proxy the loopback GUI:
sync.example.com {
reverse_proxy 127.0.0.1:8384
}
Use a real certificate, set a strong unique GUI password, and check that WebSocket behavior works through the proxy. Do not publish port 8384 directly to the internet. The Caddy HTTPS guide explains the proxy foundation, while the Authentik SSO guide covers a separate identity layer. Verify compatibility before putting an identity product in front of a service that already has its own session and API behavior.
Treat device IDs and folder-sharing invitations as sensitive configuration. A device ID is not a password, but pairing an unknown device grants it an opportunity to receive folders you share. Review the device list periodically and remove old laptops, phones, and test containers.
Use versioning for accidental changes
Syncthing can keep historical versions when files are changed or deleted on a peer. Configure versioning per folder based on the value of the data and the available storage. Simple staggered versioning is easy to understand; other versioning modes may fit a different retention policy. Check the current Syncthing documentation for the exact GUI options in your release.
Versioning is a recovery feature, not a full backup. It lives alongside the synchronized folder and can be lost with the host disk. Keep an independent backup on separate storage, preferably with encryption and multiple generations. Test restoring individual files and a complete folder before you need it.
Monitor disk usage in both the synchronized folder and the Syncthing database. Large temporary files, conflict copies, and retained versions can make growth less obvious. Set an alert for low disk space so synchronization does not fail silently or fill the host filesystem.
Back up Syncthing safely
Back up the synchronized content with a tool that understands your retention and encryption requirements. Also back up the Syncthing configuration under /var/syncthing, because it contains device and folder definitions. Stop the container or use a consistent application-aware procedure when copying configuration files.
A simple local configuration archive is:
cd /opt/syncthing
mkdir -p "$HOME/backups"
docker compose stop syncthing
umask 077
tar -czf "$HOME/backups/syncthing-config-$(date +%F).tar.gz" data
# Start the service again after the archive is complete
docker compose start syncthing
Back up /srv/sync separately. Do not assume that syncing the folder to another computer creates an immutable recovery point. Keep at least one backup generation offline or otherwise protected from the credentials and network paths used by the live Syncthing peers. Periodically restore the configuration and a sample folder on a temporary host.
Upgrade without losing synchronization
Read the Syncthing release notes before upgrading. Record the current image tag, back up configuration and important data, then change the image tag deliberately. Avoid upgrading all of your peers at the same instant; leave one known-good peer available while validating the new container.
cd /opt/syncthing
docker compose ps
docker compose config
docker compose stop syncthing
umask 077
tar -czf "$HOME/backups/syncthing-pre-upgrade-$(date +%F-%H%M).tar.gz" data
# edit compose.yml and replace the tested image tag
docker compose pull syncthing
docker compose up -d syncthing
docker compose logs --tail=100 syncthing
After an upgrade, verify the GUI, device connections, folder states, file permissions, and transfer speed. Keep the previous image available until the checks pass, and do not delete the configuration volume as a shortcut for fixing an upgrade issue. If the database or index needs repair, follow the project documentation rather than improvising destructive commands.
Troubleshoot common failures
The GUI is unreachable. Confirm that the container is running and that Syncthing is listening on 127.0.0.1:8384. If you are connecting from another machine, use the SSH tunnel, VPN, or correctly configured HTTPS proxy. STGUIADDRESS=127.0.0.1:8384 intentionally blocks direct LAN access.
Devices stay disconnected. Check that the remote device ID was entered correctly, both sides accepted the pairing, and firewalls allow the needed transfer and discovery traffic. If the peers are on different networks, test a VPN route or inspect whether a relay is being used.
The folder is out of sync. Read the folder status and logs on both peers. Check for permission errors, an ignored-pattern rule, a read-only folder role, filesystem watchers, or a full disk. A folder marked Receive Only will not send local changes back.
Files have the wrong owner. Compare the container’s PUID and PGID with the host directory ownership. Correct the IDs or ownership deliberately; do not make every folder world-writable.
Synchronization is slow. Check whether the peers are using a relay, whether a VPN or firewall is limiting traffic, and whether the disk is saturated. Large numbers of small files can be slower than a few large files, and encrypted remote links add overhead.
A deleted file came back or disappeared everywhere. Review folder roles, versioning, and the event history. Restore from Syncthing versioning or an independent backup instead of copying a damaged peer over every other peer.
FAQ
Is Syncthing a cloud-storage replacement?
It can replace the synchronization part of cloud storage for devices you control, but it does not provide the same central web drive, sharing workflow, or guaranteed off-site backup. Add a real backup system and a remote-access method when those features matter.
Does Syncthing need Docker host networking?
It does not strictly require it in every deployment, but the official Docker guidance recommends host networking because Docker bridge networking can interfere with local discovery and efficient peer connections.
Can I sync a database with Syncthing?
Do not sync a live database directory unless the database application explicitly supports it. Use database dumps or the application’s backup/export feature and synchronize those generated files instead.
Should the GUI be public?
No. Keep it on loopback and use SSH or a VPN, or protect it behind HTTPS and strong authentication. Never expose an unauthenticated GUI to the internet.
Is a second Syncthing device a backup?
Not by itself. A synchronized peer can receive deletions, corruption, or ransomware-encrypted files. Use versioning and separate, tested backups with their own retention policy.
Syncthing is most useful when you treat it as a controlled data pipeline rather than a magic backup button. Pair only trusted devices, start with one small folder, use host networking for reliable discovery, protect the GUI, and test recovery before expanding the system to important documents.