Docker compose volume mapping confusion

I’m an experienced Syncthing user trying to set it up in Docker for the first time. I would appreciate a bit of help understanding how volume mapping works.

I’m installing on a Synology NAS on which I’ve been running the SynoCommunity package for years. I want to move to Docker.

Let’s say I have a directory on the NAS at /volume1/some-folder that I want the Docker-based instance to be able to sync. If I map as:

# first mapping for config
/volume1/docker/syncthing:/var/syncthing
/volume1/some-folder:/var/syncthing/some-folder

Syncthing will create a “some-folder” directory on my NAS host at /volume1/docker/some-folder.

That’s obviously not what I want. Is this behavior specific to the /var/syncthing directory and is Syncthing trying to do me a favor by making this content available on the host?

I’m wondering if solving this is as simple as mapping the folder I want to be visible to Syncthing to anything other than /var/syncthing such as:

# first mapping for config
/volume1/docker/syncthing:/var/syncthing
/volume1/some-folder:/var/syncthing-folders/some-folder

Would appreciate clarification. Thanks!

In the sample config above, Docker binds /volume1/docker/syncthing to /var/syncthing, then because the second volume mapping requires the mount point /var/syncthing/some-folder for /volume1/some-folder, it ends up creating the subdirectory /volume1/docker/syncthing/some-folder.

A mount point below another mount point is okay, but the order the mounts happen is important.

Yup, that’s the better way to handle it. :slightly_smiling_face:

Thanks for catching this. Easy enough avoid it

Thanks for confirming. I’m up and running.

What you’re doing now works and there’s no need to change it, but I would generally go for

/volume1/some-folder:/volume1/some-folder

so that the paths look the same inside the container and outside, to minimise confusion.

Thanks for the tip - it’s a good idea.

And thanks for Syncthing - it’s such an outstanding piece of software. I’ve expressed my gratitude with contributions in the past, and I’ll do so again, but this is as good an opportunity as any to say “Thanks!”.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.