docker.recipes

Syncthing

beginner

Continuous file synchronization between devices.

Overview

Syncthing is an open-source peer-to-peer file synchronization program that keeps files synchronized between multiple devices without requiring a centralized cloud service. Originally created as a secure alternative to proprietary sync solutions, Syncthing uses end-to-end encryption and operates on a distributed model where devices connect directly to each other. Unlike cloud-based services, all data remains under your control and synchronization happens directly between your devices over local networks or the internet. This Docker configuration deploys Syncthing with the LinuxServer.io image, providing a web-based management interface and all necessary network ports for device discovery and synchronization. The setup exposes port 8384 for the web GUI, port 22000 for sync traffic between devices, and port 21027 for local device discovery. This containerized approach isolates Syncthing from the host system while maintaining full functionality for file synchronization across your network. This stack is ideal for privacy-conscious users, homelabbers, and anyone wanting to maintain control over their file synchronization without relying on third-party cloud services. Small businesses can use it to keep files synchronized across office computers, while developers can maintain consistent codebases across development machines. The combination of Docker's portability and Syncthing's decentralized architecture creates a powerful solution for maintaining file consistency across multiple devices without ongoing subscription costs or storage limitations.

Key Features

  • Peer-to-peer synchronization without requiring cloud services or central servers
  • End-to-end encryption ensures files remain private during transmission
  • Real-time file watching with instant synchronization when changes occur
  • Built-in versioning with simple, staggered, or external version control options
  • Selective synchronization allowing specific folders to be ignored or included
  • Automatic conflict resolution when the same file is modified on multiple devices
  • Local device discovery on the same network for automatic peer detection
  • Web-based management interface accessible at port 8384 for easy configuration

Common Use Cases

  • 1Synchronizing documents and files between home computers without cloud storage
  • 2Maintaining consistent development environments across multiple workstations
  • 3Creating automatic backups between a primary computer and NAS device
  • 4Sharing files within a small office network while keeping data on-premises
  • 5Synchronizing media libraries between media servers and client devices
  • 6Keeping configuration files and dotfiles synchronized across Linux machines
  • 7Creating a distributed backup system across multiple geographic locations

Prerequisites

  • Minimum 256MB RAM available for the Syncthing container
  • TCP port 22000 and UDP ports 22000, 21027 accessible for device communication
  • Storage space for configuration data and synchronized files
  • Network connectivity between devices you want to synchronize
  • Understanding of Docker volumes for mapping host directories to sync
  • Basic knowledge of firewall configuration if running across networks

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 syncthing:
3 image: linuxserver/syncthing:latest
4 container_name: syncthing
5 restart: unless-stopped
6 environment:
7 PUID: 1000
8 PGID: 1000
9 TZ: UTC
10 volumes:
11 - syncthing_config:/config
12 - /path/to/data:/data
13 ports:
14 - "8384:8384"
15 - "22000:22000/tcp"
16 - "22000:22000/udp"
17 - "21027:21027/udp"
18
19volumes:
20 syncthing_config:

.env Template

.env
1# Mount your data folder

Usage Notes

  1. 1Docs: https://docs.syncthing.net/
  2. 2Web UI at http://localhost:8384
  3. 3Add remote devices by exchanging Device IDs
  4. 4P2P sync - no cloud required, works over LAN and internet
  5. 5Port 22000 for sync traffic, 21027 for local discovery
  6. 6Versioning available: simple, staggered, or external

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 syncthing:
5 image: linuxserver/syncthing:latest
6 container_name: syncthing
7 restart: unless-stopped
8 environment:
9 PUID: 1000
10 PGID: 1000
11 TZ: UTC
12 volumes:
13 - syncthing_config:/config
14 - /path/to/data:/data
15 ports:
16 - "8384:8384"
17 - "22000:22000/tcp"
18 - "22000:22000/udp"
19 - "21027:21027/udp"
20
21volumes:
22 syncthing_config:
23EOF
24
25# 2. Create the .env file
26cat > .env << 'EOF'
27# Mount your data folder
28EOF
29
30# 3. Start the services
31docker compose up -d
32
33# 4. View logs
34docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/syncthing/run | bash

Troubleshooting

  • Devices not discovering each other automatically: Check that UDP port 21027 is open and devices are on the same subnet, or add devices manually using their Device IDs
  • Sync stalled at 99% or showing 'Syncing' indefinitely: Restart both Syncthing instances and check for file permission issues on the destination
  • Connection failed errors between devices: Verify TCP port 22000 is accessible and not blocked by firewalls on either device
  • Web interface shows 'Failed to load config' error: Check that the container has write permissions to the config volume and restart the container
  • Files not synchronizing despite connection: Verify folder paths exist on both devices and check folder sharing settings in the web interface
  • High CPU usage during initial sync: This is normal for large folders; consider using 'Scan Interval' settings to reduce frequency after initial sync completes

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space