我知道这个问题已经在网上完成了,但是我找不到适合我的解决方案。
我安装了一台服务器 (VM1),sshfs它应该提供远程文件系统存储。我有另一个运行容器的服务器 (VM2),我希望这些容器使用托管在 VM1 中的卷。
我遵循了这个官方 docker指南 所以在 VM1 中我跑了:
docker plugin install vieux/sshfs DEBUG=1 sshkey.source=/home/debian/.ssh/
Run Code Online (Sandbox Code Playgroud)
在 VM 2 中,我跑了:
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
Run Code Online (Sandbox Code Playgroud)
这是检查输出:
[
{
"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"
}
]
Run Code Online (Sandbox Code Playgroud)
在VM1中,我也跑了:
docker run -it -v remotevolume:/home -d ubuntu
Run Code Online (Sandbox Code Playgroud)
但我收到了这个错误:
docker: Error response from daemon: VolumeDriver.Mount: sshfs command execute failed: exit status 1 (read: Connection reset by peer
). See 'docker run --help'.
Run Code Online (Sandbox Code Playgroud)
也许这是一个很久以前问过的问题,也许它会对其他新手有所帮助。远程虚拟机/etc/ssh/sshd_config文件内容检查属性PasswordAuthentication yes
如果为“是”,我们可以使用密码传递参数。否则,将其更改为“否”并重新启动 ssh 或 sshd 服务。
service ssh restart
service ssh status
Run Code Online (Sandbox Code Playgroud)
还有密码验证。根据您的 PAM 配置,也请检查一下。
如果是AWS实例则使用命令passwdubuntu重置密码 # 这里ubuntu是ec2 ubuntu实例中的默认用户
| 归档时间: |
|
| 查看次数: |
1686 次 |
| 最近记录: |