Howto use docker volumes containing remote sshfs mounts

For my audiobook-feeds github repository I needed docker to be able to use a host volume mount which contained a remote  sshfs mount located on my local raspberry pi with a attached external hard drive. For my own sake of documentation and to offer you something to profit from, I created this small howto:

First of all, connect to your server and mount your remote device via sshfs using the -o allow_root flag. The allow_other option I tried first didn’t work for some reason.

sudo sshfs paul@ /my/local/server/path/files/ -o allow_root,reconnect,default_permissions

Then run the container using the –privileged flag.

sudo docker run --privileged --rm -v `pwd`:/usr/src/myapp -w /usr/src/myapp -it --rm -p --name audiobook-feeds audiobook-feeds go run feed.go

After that the root user of the container is able to list and to server the remote files.