Docker Volume with SSHFS

Using an ssh key

  • Install plugin
$ docker plugin install vieux/sshfs sshkey.source=/home/<user>/.ssh/

# or to enable debug
docker plugin install vieux/sshfs DEBUG=1 sshkey.source=/home/<user>/.ssh/

# or to change where plugin state is stored
docker plugin install vieux/sshfs state.source=<any_folder> sshkey.source=/home/<user>/.ssh/
  • Create docker volume
docker volume create -d vieux/sshfs -o sshcmd=<[email protected]:path> [-o IdentityFile=/root/.ssh/<key>] [-o port=<port>] [-o <any_sshfs_-o_option> ] sshvolume
  • Use the volume
$ docker run -it -v sshvolume:<path> busybox ls <Paste>

Reference: https://github.com/vieux/docker-volume-sshfs

Written on September 4, 2018