I'm trying to run a docker image for mounting hubic (online storage) and expose that to the host

What is working so far is container mounting the fuse point correctly (to /mnt/hubic)

When running docker I am attempting to run with volume mapped as /path/on/host:/mnt/hubic this appears to work ( ie docker makes the directory if it doesn't exist) but the contents never appear. If I enter the container I can see the files from the online storage but the host folder contains nothing

Is there an option I'm missing to allow docker to do this ?

Command I am using to start the container

docker run -v ~/.hubicfuse:/root/.hubicfuse -v /tmp/mounted:/mnt/hubic --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined -it {container_name}

  • @kamil I wish to read the files from the host. Using a shared volume. Normally inside a container you can mount a directory from inside to be a real directory on the host. Hoping this is also possible with fuse – exussum Nov 11 '18 at 20:51
  • See this answer on using the :shared flag, which might also work for FUSE. – harrymc Nov 12 '18 at 7:40
  • @harrymc that worked ! can you make it an answer ? – exussum Nov 12 '18 at 19:21
  • 1
    Done as requested. – harrymc Nov 12 '18 at 19:35

The solution comes from the post s3 mounted inside the container. how to expose it to the host?

In this post is described a solution using glusterFS, requiring more permissions for the container. The docker command used:

docker run --cap-add SYS_ADMIN --device fuse -v host_mount_dir:container_mount_dir:shared IMAGE COMMAND

For an error like "Path /foo is mounted on /foo but it is not a shared mount ...", the reason is that the docker daemon runs in different mount namespace than systemd. This is the solution for making it run in the same namespace:

mkdir -p /etc/systemd/system/docker.service.d/
cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf

And restart the docker daemon.

A remark is that the mount is visible on the host if mounted into a directory binded by -v.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.