Mount a SSHFS volume into a Docker instance

Ralph asked:

I use SSHFS to mount a remote filesystem on my host and I want to be able to access it from inside a Docker container.

I mount the remote filesystem

sshfs -o idmap=user,uid=$(id -u),gid=$(id -g) [email protected]:directory /path/to/sshfs

And, using Docker, I get the following errors depending on me using --mount:

docker run  -it -v /path/to/sshfs:/target myimage bash
docker: Error response from daemon: error while creating mount source path '/path/to/sshfs': mkdir /path/to/sshfs: file exists.

or -v:

docker run -it  --mount src=/path/to/sshfs,target=/target,type=bind  myimage bash
docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /path/to/sshfs.
See 'docker run --help'

Is it possible to mount a sshfs mountpoint into a container?

My answer:


You need to uncomment user_allow_other in /etc/fuse.conf. Then unmount and remount the FUSE filesystem, and try starting the container again.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.