ATTENTION : never create two mounts to the same place with docker volumes.
https://github.com/vieux/docker-volume-sshfs/issues/81
https://github.com/fentas/docker-volume-davfs/issues/6
install
apt-get install sshfs
put this in root crontab
crontab -e
@reboot /root/mountsshfs.sh
create script
emacs /root/mountsshfs.sh
sleep 10
mkdir /mnt/droplet
sshfs -o allow_other,default_permissions,IdentityFile=~/.ssh/id_rsa root@localhost:/ /mnt/droplet
remove mount
umount /mnt/droplet
attention : it works but i had 2 major total data loss using this module (once a year). And i cant understand what caused that. must be unstable.
docker plugin install vieux/sshfs
docker plugin disable vieux/sshfs
docker plugin set vieux/sshfs sshkey.source=/root/.ssh/
docker plugin enable vieux/sshfs
docker inspect vieux/sshfs
test that it works
docker volume create -d vieux/sshfs --name sshvolume -o sshcmd=root@flatbay.fr:/root/docker/flatbay/uploads -o IdentityFile=/root/.ssh/id_rsa
docker run --rm -it -v sshvolume:/testfolder busybox ls /testfolder
equivalent docker compose
version: "3.3"
# docker exec -ti test ls /mount
services:
test:
image: busybox
restart: always
container_name: test
volumes:
- sshflatbaytest:/mount
command: sleep 10000
volumes:
sshflatbaytest:
# name: sshflatbay
# external: true
driver: vieux/sshfs:latest
driver_opts:
sshcmd: "root@flatbay.fr:/root/test"
IdentityFile: "/root/.ssh/id_rsa"
# allow_other: ""
# default_permissions: ""