vieux / docker-volume-sshfs

sshfs docker volume plugin
MIT License
592 stars 104 forks source link

mount volume sshfs between stack #75

Open SqLL opened 4 years ago

SqLL commented 4 years ago

Hello everyone,

Goal Is it possible than two different docker volume ssh use the same mountpoint?

Expected Because I have two docker volume, i expect than there is two different mountpoint. (Maybe that is a wrong assumption..)

Context : In two separate docker stack, I describe a volume like this :

volumes:
  access-log:
  file-feedback:
    driver: vieux/sshfs:latest
    driver_opts:
      sshcmd: "$FILE_USER@$FILE_SSH_IP:/data/Store/file/feedbacks"
      IdentityFile: "/root/.ssh/$FILE_SSH_KEY"

stack1_file-feedback is created that is fine and the volume and everything is working fine.

I use the same ssh user and file and mountpoint to create a new docker volume

volumes:
  access-log:
  file-feedback:
    driver: vieux/sshfs:latest
    driver_opts:
      sshcmd: "$FILE_USER@$FILE_SSH_IP:/data/Store/file/feedbacks"
      IdentityFile: "/root/.ssh/$FILE_SSH_KEY"

stack2_file-feedback is created

docker volume ls 
DRIVER               VOLUME NAME
vieux/sshfs:latest   stack1_file-feedback
vieux/sshfs:latest   stack2_file-feedback

let's have a closer view with docker inspect.

docker volume inspect stack1_file-feedback stack2_file-feedback | grep "/mnt/volumes/265b1674263688dc91b1ee6a2febace9"
        "Mountpoint": "/mnt/volumes/265b1674263688dc91b1ee6a2febace9",
        "Mountpoint": "/mnt/volumes/265b1674263688dc91b1ee6a2febace9",

but if we do a docker inspect I can see that have the same mountpoint or I declare them and create them in two stack to try to make some isolation.

Is it normal to have the same mountpoint? Is it possible to specify the mountpoint ? Is it possible to create a different mountpoint by stack or by settings opt?

If none options are available, I will probably create an external volume and reference it in both stack.

Kr,