Docker - Syncthing Container Setup
Run the Docker pull command:
docker pull syncthing/syncthing
Within my home folder I have created a Docker folder where I create a subfolder for each container:
cd ~ mkdir -p docker/syncthing cd docker/syncthing
Also create the following folders:
mkdir st-sync mkdir data
I use the Nano text editor to create a shell script:
sudo nano syncthing_run.sh
With this shell script we are going to create the container.
Copy the following into
IDu=$(id -u $(logname)) # Saves the logged in user id in the IDu variable IDg=$(id -g $(logname)) # Saves the logged in user group in the IDg variable docker run -d \ --name syncthing \ --hostname=syncthing-ubuntuvm \ --network=host \ -v $PWD/st-sync/:/var/syncthing/ \ -v $PWD/data/:/var/syncthing/data/ \ -v /mnt/fileserver/archive/:/var/syncthing/archive/ \ -e TZ="Europe/Amsterdam" \ -e PUID=$IDu \ -e PGID=$IDg \ --restart=unless-stopped \ syncthing/syncthing:latest
If necessary, adjust the following:
Since I have Syncthing running on multiple devices, the hostname will differ per device. In this case I chose my Ubuntu VM as an example. Replace
ubuntuvmwith your own name
This is an example of a folder you can sync. In this case the mapping allows us to select and sync the contents of the data folder within Syncthing. Adjust this to your own wishes
This is an example of a folder you can sync. In this case the mapping allows us to select and sync the contents of a folder from my fileserver which is mounted on the Docker host (Ubuntu). Adjust this to your own wishes
Pick the right timezone
Exit Nano (CTRL-X) and save the changes.
Make sure port
8384 is available. Check this with netstat.
Now create the container:
sudo sh syncthing_run.sh
Check if the container is running properly.
Syncthing can now be accessed via the following URL:
http://<IP DOCKER HOST>:8384/
If you see a message about the inotify limits run the following on the Docker host:
echo "fs.inotify.max_user_watches=204800" | sudo tee -a /etc/sysctl.conf sudo sh -c 'echo 204800 > /proc/sys/fs/inotify/max_user_watches'
In my case I had to run this on my Synology NAS where I had Syncthing running using the Docker application
First I turned on authentication and the option to use HTTPS for the GUI:
GUI Authentication User: your syncthing user
GUI Authentication Password: your syncthing password
Use HTTPS for GUI: turn
Now Syncthing can be accessed via the following URL (https instead of http!):
https://<IP DOCKER HOST>:8384/
Within my local network I use Syncthing with a number of different devices that run on Linux, Windows and Android. I disabled the following settings because I didn’t think it was necessary:
Enable NAT traversal: turn
Global Discovery: turn
Enable Relaying: turn
(or do some research and make your own settings if desired)
Since sending crash reports is turned on by default without prompting I turned this off:
Crash Reporting Enabled: turn
Now you can add folder(s) to sync by clicking on
Add Folder in the main screen. The Docker mappings can be selected by browsing under
Folder Path to
Read other notes
No comments found for this note.
Join the discussion for this note on this ticket. Comments appear on this page instantly.
Notes mentioning this note
- Obsidian - Installation and Syncing with Syncthing
I installed Obisidian on Windows (x2) and Android.