Syncthing in Docker on Synology NAS

I would like to get a few files sync’ed directly from my NAS (DS220+) to my Android phone.

For that purpose I installed Syncthing as a docker container (following instructions on How to Install Syncthing on Your Synology NAS – Marius Hosting). So far this seemed to have worked OK - container is up and running. The mount paths as displayed in the volume settings after installation are: /docker/syncthing → /config /docker/syncthing/data1 → /data1 /docker/syncthing/data2 → /data2 (FWIW: Unlike in the instructions I decided to create the mount paths for data1 and data2 in /docker/syncthing and not in /docker, to avoid cluttering my docker path)

However I’m struggling to get a (shared) folder from outside mounted into the container so that I can sync its contents. I read the basic help about docker in Synology Help and other places. I understand there are different mount types (volume, bind, tmpfs) but have no way to find out which type Synology uses when I specify a mount path in the volume settings. I’m not sure if the type is relevant - is it?

I added a mount-path for my shared folder as: /shared/Syncthing → /config/NAS-sync where /shared is one of my shared folders as displayed in DSM File Station. Looking at the contents with bash-terminal (from within the running container) I do see the folder “NAS-sync” in /config and correct content, but with odd permissions

root@badecafee17f:/# ls -al config | grep NAS d--------- 1 1027 abc 90 Sep 20 16:47 NAS-sync

On Android phone: I installed Syncthing, setup my NAS as device and established connection OK. When I set up “Sync2NAS” on my phone as local folder and accept this folder under my NAS device (on phone) it instantly gets replicated to my NAS filesystem under the name “Sync2NAS” in the /config folder (note the different permissions and quotes compared to above):

root@badecafee17f:/config# ls -al | grep NAS drwxr-xr-x 1 abc abc 46 Sep 20 18:06 ‘Sync2NAS’

Now I have two different folders, one mounted from the NAS-side and one created by Syncthing on the phone - but no way to sync files between them.

Trying to give the folder on the phone the same name as the one mounted, ends up in a folder being created on the NAS with the cryptic folder ID instead of using the name (which would be conflicting with the existing folder).

Trying the other way round (first having the folder created from remote, then mounting the NAS shared folder under that very name) ends with an error: Network unreachable" when trying to synchronize new content.

I am new to docker and to Syncthing, and never before ventured into the depths of the DSM. So I may have missed something fundamental. Any help is appreciated!

I have docker installations running on my Synology NAS’n in parallel to native installations. I use the Kastelo version, so my instructions are only running with that package.

Regarding permissions, a user is correctly required and a group. These can be created in the DSM or via the console. Their IDś are in /etc/passwd and /etc/group and the IDś are stored as PUID and PGID in the Docker container variables. Thus Docker has an assignment and corresponding accesses can be assigned in the DSM in the shared folders.

To install an update, I have a default configuration that I use each time to import and deploy the latest image. So you only need to load the latest image into Docker and import it via the config and start the container.

In principle, the config looks like this:

{
   "cap_add" : [],
   "cap_drop" : [],
   "cmd" : "",
   "cpu_priority" : 50,
   "devices" : null,
   "enable_publish_all_ports" : false,
   "enable_restart_policy" : false,
   "enabled" : true,
   "entrypoint_default" : "/bin/entrypoint.sh /bin/syncthing -home /var/syncthing/config",
   "env_variables" : [
      {
         "key" : "PATH",
         "value" : "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      },
      {
         "key" : "PUID",
         "value" : "1085"
      },
      {
         "key" : "PGID",
         "value" : "65571"
      },
      {
         "key" : "HOME",
         "value" : "/var/syncthing"
      },
      {
         "key" : "STGUIADDRESS",
         "value" : "0.0.0.0:8384"
      }
   ],
   "exporting" : false,
   "id" : "#####################################",
   "image" : "syncthing/syncthing:latest",
   "is_ddsm" : false,
   "is_package" : false,
   "links" : [],
   "memory_limit" : 0,
   "name" : "syncthing-syncthing",
   "network" : [
      {
         "driver" : "bridge",
         "name" : "bridge"
      }
   ],
   "network_mode" : "bridge",
   "port_bindings" : [
      {
         "container_port" : 21027,
         "host_port" : 21027,
         "type" : "udp"
      },
      {
         "container_port" : 22000,
         "host_port" : 22000,
         "type" : "tcp"
      },
      {
         "container_port" : 8384,
         "host_port" : 8384,
         "type" : "tcp"
      }
   ],
   "privileged" : false,
   "shortcut" : {
      "enable_shortcut" : false
   },
   "use_host_network" : false,
   "volume_bindings" : [
      {
         "host_volume_file" : "/Ablage",
         "mount_point" : "/Folders/Ablage/",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/Downloads",
         "mount_point" : "/Folders/Downloads/",
         "type" : "rw"
      },
    .
    .
    .
    .
    .
    .
    .
      {
         "host_volume_file" : "/homes/syncthing-dk",
         "mount_point" : "/var/syncthing/",
         "type" : "rw"
      }
   ]
}

The folder /homes/syncthing-dk is in my case the physical folder, in which all files and data are stored of the Docker container. This my is different to your location.

The folders above with the parameter host_volume_file are the physical folders in the DSM. In my case the folder Ablage is a shared folder in the root of a volume, it means in my case is /volume1/Ablage and in this folder the DSM permissions of PUID and PGID are stored.

Hi Andy, thanks for jumping in. While I started off with Linux back in the lat 80s (or UNIX to be precise), I turned to a Windows person over the long years, so my Linux background is rudimentary. Just as a heads-up :slight_smile: As I already mentioned, I installed Syncthing following the instructions by mariushosting (see link above) who seems to get the package from Package syncthing · GitHub. The deviations from these instructions I also mentioned above: I decided to create the mount paths for data1 and data2 in /docker/syncthing and not in /docker, to avoid cluttering my docker path. No idea if this matters. I’d be curious to have a look at the configuration as you put it in your post. Where do I find it? Somehwere I read that it is in /etc/docker but I only find a key.json file there, which I can’t read, because I logged in with an admin account. I didn’t manage to switch user to root (wouldn’t know the password anyway). And from a terminal session within docker (where I am root), I can’t get outside the container (or can I?). When I started off, I thought it was a simple task, but now I find myself confronted with a lot of problems, that seem to go way beyond my rusty Linux skills… I’d appreciate if you could consider my limitations in further suggestions :slight_smile:

Main informations are here

and here

https://hub.docker.com/r/syncthing/syncthing