docker.recipes

Syncthing File Synchronization

beginner

Continuous file synchronization between devices with encryption and web UI.

Overview

Syncthing is a continuous file synchronization program that synchronizes files between two or more computers in real time using peer-to-peer technology, eliminating the need for cloud storage services or central servers. Originally developed in 2013 as an open-source alternative to proprietary sync solutions, Syncthing encrypts all data end-to-end and operates entirely on your own devices, making it ideal for privacy-conscious users and organizations with strict data sovereignty requirements. This deployment combines Syncthing with NGINX to create a robust file synchronization platform where NGINX acts as a reverse proxy, providing SSL termination, rate limiting, and enhanced security for the Syncthing web interface. The NGINX proxy enables secure remote access to Syncthing's management interface while protecting it from direct internet exposure, allowing administrators to manage sync relationships and monitor transfer status through a properly secured web interface. This combination is perfect for small teams, home labs, and organizations that need reliable file synchronization without relying on third-party cloud providers, offering complete control over data location and access while maintaining the convenience of modern sync solutions.

Key Features

  • Peer-to-peer file synchronization without central servers or cloud dependency
  • End-to-end AES encryption for all synchronized data with perfect forward secrecy
  • Real-time conflict detection and resolution with versioning support
  • Cross-platform device support including Windows, macOS, Linux, Android, and FreeBSD
  • Selective folder synchronization with ignore patterns and partial sync capabilities
  • NGINX reverse proxy with SSL termination and rate limiting for secure web interface access
  • Block-level delta sync to minimize bandwidth usage on large files
  • Web-based GUI for device management, folder configuration, and sync monitoring

Common Use Cases

  • 1Home office setups synchronizing documents between desktop, laptop, and mobile devices
  • 2Small development teams sharing code repositories and documentation without GitHub dependency
  • 3Photography studios synchronizing RAW files and edited photos across workstations
  • 4Family file sharing for photos, videos, and documents without cloud storage fees
  • 5Remote workers maintaining synchronized project files across multiple locations
  • 6Organizations with data sovereignty requirements keeping files on-premises
  • 7Home lab enthusiasts creating personal cloud storage with multiple devices

Prerequisites

  • Minimum 256MB RAM available for Syncthing and 64MB for NGINX reverse proxy
  • Open ports 8384 (web UI), 22000 (sync protocol), and 21027 (discovery) on firewall
  • SSL certificates configured in NGINX for secure remote access to web interface
  • Sufficient disk space on sync folders with at least 10% free space buffer
  • Network connectivity between all devices that will participate in sync relationships
  • Understanding of folder sharing permissions and device trust relationships

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: lscr.io/linuxserver/syncthing:latest
4 environment:
5 PUID: 1000
6 PGID: 1000
7 TZ: ${TZ}
8 ports:
9 - "8384:8384"
10 - "22000:22000/tcp"
11 - "22000:22000/udp"
12 - "21027:21027/udp"
13 volumes:
14 - syncthing_config:/config
15 - syncthing_data:/data
16 networks:
17 - syncthing-net
18 restart: unless-stopped
19
20 nginx:
21 image: nginx:alpine
22 ports:
23 - "80:80"
24 - "443:443"
25 volumes:
26 - ./nginx.conf:/etc/nginx/nginx.conf:ro
27 depends_on:
28 - syncthing
29 networks:
30 - syncthing-net
31 restart: unless-stopped
32
33volumes:
34 syncthing_config:
35 syncthing_data:
36
37networks:
38 syncthing-net:
39 driver: bridge

.env Template

.env
1# Timezone
2TZ=UTC
3
4# User/Group IDs
5PUID=1000
6PGID=1000

Usage Notes

  1. 1Web UI at http://localhost:8384
  2. 2Add devices via device ID
  3. 3End-to-end encryption
  4. 4No central server required

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

syncthing
syncthing:
  image: lscr.io/linuxserver/syncthing:latest
  environment:
    PUID: 1000
    PGID: 1000
    TZ: ${TZ}
  ports:
    - "8384:8384"
    - 22000:22000/tcp
    - 22000:22000/udp
    - 21027:21027/udp
  volumes:
    - syncthing_config:/config
    - syncthing_data:/data
  networks:
    - syncthing-net
  restart: unless-stopped
nginx
nginx:
  image: nginx:alpine
  ports:
    - "80:80"
    - "443:443"
  volumes:
    - ./nginx.conf:/etc/nginx/nginx.conf:ro
  depends_on:
    - syncthing
  networks:
    - syncthing-net
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 syncthing:
5 image: lscr.io/linuxserver/syncthing:latest
6 environment:
7 PUID: 1000
8 PGID: 1000
9 TZ: ${TZ}
10 ports:
11 - "8384:8384"
12 - "22000:22000/tcp"
13 - "22000:22000/udp"
14 - "21027:21027/udp"
15 volumes:
16 - syncthing_config:/config
17 - syncthing_data:/data
18 networks:
19 - syncthing-net
20 restart: unless-stopped
21
22 nginx:
23 image: nginx:alpine
24 ports:
25 - "80:80"
26 - "443:443"
27 volumes:
28 - ./nginx.conf:/etc/nginx/nginx.conf:ro
29 depends_on:
30 - syncthing
31 networks:
32 - syncthing-net
33 restart: unless-stopped
34
35volumes:
36 syncthing_config:
37 syncthing_data:
38
39networks:
40 syncthing-net:
41 driver: bridge
42EOF
43
44# 2. Create the .env file
45cat > .env << 'EOF'
46# Timezone
47TZ=UTC
48
49# User/Group IDs
50PUID=1000
51PGID=1000
52EOF
53
54# 3. Start the services
55docker compose up -d
56
57# 4. View logs
58docker 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-file-sync/run | bash

Troubleshooting

  • Syncthing GUI shows 'Connection refused': Check that port 8384 is accessible and not blocked by firewall
  • Devices not discovering each other: Verify port 21027/UDP is open for local discovery protocol
  • Sync stuck at 0% with large files: Increase Syncthing's bandwidth limits in advanced settings
  • NGINX 502 Bad Gateway errors: Ensure Syncthing container is running and accessible on port 8384
  • Files not syncing despite connection: Check folder permissions and verify both devices have read/write access
  • High CPU usage during sync: Enable Syncthing's built-in rate limiting to reduce resource consumption

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