Docker mounting remote volume with sshfs
Asked Answered
I

1

6

I know that this question has been done on the web, but I am not able to find a suitable solution for me.

I have one server (VM1) with sshfs installed that should provide remote file system storage. I have another server (VM2) where containers are run, I would like that these containers use volumes hosted in VM1.

I followed this official docker guide So in VM1 I ran:

docker plugin install vieux/sshfs DEBUG=1 sshkey.source=/home/debian/.ssh/

In VM 2 I ran:

docker volume create --name remotevolume -d vieux/sshfs -o sshcmd=debian@vm1:/home/debian/sshfs300 -o IdentityFile=/home/csicari/data/Mega/lavoro/keys/vm-csicari.key -o -o allow_other  -o nonempty

This is the inspect output:

[
  {
   "CreatedAt": "0001-01-01T00:00:00Z",
   "Driver": "vieux/sshfs:latest",
   "Labels": {},
   "Mountpoint": "/mnt/volumes/895d7f7679f69131500c786d7fe5fdc1",
   "Name": "remotevolume",
   "Options": {
             "IdentityFile": "/home/csicari/data/Mega/lavoro/keys/vm-csicari.key",
             "sshcmd": "debian@vm1:/home/debian/sshfs300"
  },
  "Scope": "local"
  }
]

In VM1 I ran also:

docker run -it -v remotevolume:/home -d ubuntu

But I got this error:

docker: Error response from daemon: VolumeDriver.Mount: sshfs command execute failed: exit status 1 (read: Connection reset by peer
). See 'docker run --help'.
Inessential answered 29/4, 2020 at 15:24 Comment(0)
B
1

Maybe this is a long back asked question maybe it will help other newbies. The remote VM /etc/ssh/sshd_config file content check the property PasswordAuthentication yes If it is 'yes' we can use with password passing parameter. otherwise, change it to 'no' and restart the ssh or sshd service.

service ssh restart
service ssh status

And also PasswordAuthentication. Depending on your PAM configuration, so check that as well.

If it is AWS instance reset the password using the command passwd ubuntu # Here ubuntu is the default user in ec2 ubuntu instance

Badlands answered 2/5, 2021 at 4:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.