[Docker] Can someone explain bind propagation to me, and why my /data mount needs the ":shared" propagation?

What is the problem you are having with rclone?

I would like to understand what the :shared propagation means for my /data mount in my docker run command. e.g. - docker run -v /data:/data:shared rclone/rclone

What is your rclone version (output from rclone version)

Haven't created container yet; will use latest version.

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux (Raspbian Lite, 32-bit)

Which cloud storage system are you using? (eg Google Drive)


The command you were trying to run (eg rclone copy /tmp remote:tmp)

docker run -v /data:/data:shared rclone/rclone

The rclone config contents with secrets removed.

No config created yet

A log from the command with the -vv flag

No log created yet

Additional info:

As mentioned, I just wanted to understand what the :shared propagation option means, and what would happen if I didn't include it at all? I assume (wrongly?) that this is just a Docker thing. I'm just trying to wrap my head all of this and what's doing what, instead just copying/pasting the commands not understanding what they're doing.

I have read extensive Docker documentation and still am unable to understand why rclone needs :shared. Bind propagations need to be used when I'm adding additional mounts underneath another one (the docker docs call these "sub-mounts"), but I'm only passing in one data dir to the docker container -v /data:/data.

Thank you for your help. Would love to provide follow up info upon request.

You need this for rclone mount in the docker container to be visible on the host.

The rclone mount is a sub mount, because the first mount is mounting /data into the docker container's file system. That is known as a bind mount to glue on a bit of filesystem somewhere else - hence the "bind propagation". The submount is the rclone mount mounting on to /data

Here are the docs which are pretty impenetrable!

shared Sub-mounts of the original mount are exposed to replica mounts, and sub-mounts of replica mounts are also propagated to the original mount.

It would help if they explained what a "replica mount" is (I don't know!).

There is a stack overflow answer here which is quite helpful

Hey, Nick. Thanks so much for the answer. For the first time, after trying to understand the logic behind this for two days, I think I understand because of you saying:

And that Stack Overflow link was incredibly helpful too with a real-world example.

Because I'm not very familiar with Rclone (yet!), I wasn't clear on how it worked. It works by mounting the cloud storage solution to a folder (what the Docker docs refer to as a sub-mount). And you want that mount to be visible on the host, which is why you flag it with :shared.

I follow you. We're kind of getting into the weeds in regards to how Docker works, but maybe you could answer this for me: why does the host need to be able to see this mount?

How I understand it: Rclone is working inside of the container. I pass some files/directories into it with -v /data:/data:shared. Now, rclone, inside of the Docker container, mounts Dropbox so that it can sync. At this point, the container itself is seeing the files I passed in at container creation, and it is also seeing the mount that Rclone itself mounted in the container. This has all happened inside the Docker container. Why does the host need to be able to see this mount with :shared? Rclone can already see it.

The host doesn't need to be able to see the files - I assume that is what you wanted?

If you leave off the :shared then the mount will only be visible from within the docker container.

Ah, if you are doing rclone sync then rclone doesn't mount files at all and you don't need the :shared.

What command are you running with the rclone container?

I was planning on using rclone sync. Was going to set up a simple cron job to send the files to Dropbox as a nightly backup of my home NAS.

I personally wasn't planning on using rclone mount at this time.

:shared in your Docker installation instructions is just there to make sure rclone mount functions properly if or when it's used?

edit - I'm realizing now that it was the rclone mount command you called in your example on the Installation doc, which may have just answered my last question.

That is correct, yes.

A simpler docker command like this should work for syncing

docker run --rm \
    --volume ~/.config/rclone:/config/rclone \
    --volume ~/path/to/mystuff:/data \
    --user $(id -u):$(id -g) \
    rclone/rclone \
    sync -v /data dropbox:destination

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