我知道这个问题已经在网上完成了,但是我找不到适合我的解决方案。
我安装了一台服务器 (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 …Run Code Online (Sandbox Code Playgroud)