[英]Docker nfs volume - no such file or directory
I've been trying to find examples and doing some testing for a few days now....got to the point where I need some help...几天来,我一直在尝试寻找示例并进行一些测试....到了需要帮助的地步...
Note: I'm using root to to get things working then I'll try using another user... I feel another headache coming on...注意:我正在使用 root 来让事情正常工作,然后我会尝试使用另一个用户......我觉得又一个头痛来了......
Overview:概述:
Running OMV 6 on standalone PC, another standalone PC running proxmox with Ubunutu VM with docker.在独立 PC 上运行 OMV 6,另一台使用带有 docker 的 Ubunutu VM 运行 proxmox 的独立 PC。
Goal: get NFS shares working on Ubuntu VM so I can spin up docker containers using the NFS shares as volumes目标:让 NFS 共享在 Ubuntu VM 上运行,这样我就可以使用 NFS 共享作为卷来启动 docker 容器
OMV 6 - 10.10.10.110 (myvault) OMV 6 - 10.10.10.110 (myvault)
setup NFS shares as follows all via the GUI, just looking at CLI for simplicity通过 GUI 如下设置 NFS 共享,为简单起见仅查看 CLI
when i go into /export/movies I can see all the files I expect to当我进入 /export/movies 时,我可以看到我希望看到的所有文件
root@myvault:/export# ls -l
total 68
drwxrwsrwx+ 1020 root users 53248 Jan 18 2021 movies
drwxrwsr-x 87 root users 4096 Dec 16 2020 music
drwxrwsr-x+ 5 root users 4096 Sep 8 2021 plex-config
drwxrwsr-x 5 root users 4096 Aug 14 2020 tv
root@myvault:/export
Proxmox on 10.10.10.160 10.10.10.160 上的 Proxmox
VM - Ubuntu 22.04 with docker 10.10.10.161 (docker-pve)虚拟机 - 带有 docker 10.10.10.161 (docker-pve) 的 Ubuntu 22.04
NFS shares can be seen from 161 ie docker host...从 161 即 docker 主机可以看到 NFS 共享...
root@docker-pve:/# showmount -e 10.10.10.110
Export list for 10.10.10.110:
/export/movies *
/export (everyone)
/export/tv 10.10.10.161
/export/music 10.10.10.161
/export/plex-config 10.10.10.161
root@docker-pve:/#
Creating (seemingly) simple test volume on ubuntu server在 ubuntu 服务器上创建(看似)简单的测试卷
root@docker-pve:/# docker volume create --driver local \
--opt type=nfs \
--opt o=addr=10.10.10.110,nfsvers=4 \
--opt device=:/export/movies foo
foo
root@docker-pve:/#
Looking into the foo volume...查看 foo 卷...
root@docker-pve:/var/lib/docker/volumes/foo/_data# ls -l
total 0
root@docker-pve:/var/lib/docker/volumes/foo/_data#
Q1 - Is this normal? Q1 - 这是正常的吗?
I expected to see all the files I saw before from the other pc when I went to /export/movies当我去 /export/movies 时,我希望能从另一台电脑上看到我之前看到的所有文件
Then running a test docker container...然后运行一个测试docker容器......
root@docker-pve:/# docker run -it --rm --name nfs-test -v foo:/data alpine sh
docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/foo/_data': failed to mount local volume: mount :/export/movies:/var/lib/docker/volumes/foo/_data, data: addr=10.10.10.110,nfsvers=4: no such file or directory.
ERRO[0000] error waiting for container: context canceled
root@docker-pve:/#
And this where I got stuck...这就是我卡住的地方......
Any guidance would be greatly appreciated...任何指导将不胜感激......
[edit] replaced images with codeblocks [编辑] 用代码块替换图像
Seems issue was PEBKAC....似乎问题是PEBKAC....
on my OMV the movies shared folder was linked to a single disk the music shared folder was linked to the shared pool of disk ie 1 or all 4 disks of the pool may or may not have that folder on them...在我的 OMV 上,电影共享文件夹链接到单个磁盘音乐共享文件夹链接到磁盘共享池,即池中的 1 个或所有 4 个磁盘可能有也可能没有那个文件夹...
Complicated issue..after I had setup the shared folder in the OMV GUI, I had done some HW maintenace and moved some sata cables thus sdc1 now became sda1... long story short the shared folder moviews I had linked to a particular disk ....that disk no longer had a folder called movies there...复杂的问题..在 OMV GUI 中设置共享文件夹后,我进行了一些硬件维护并移动了一些 sata 电缆,因此 sdc1 现在变成了 sda1 ...长话短说,我已链接到特定磁盘的共享文件夹 moviews 。 ...该磁盘不再有一个名为 movies 的文件夹...
So the following docker-compose in a portainer stacks editor works ...因此,搬运工堆栈编辑器中的以下 docker-compose 可以工作...
... (note following block is not showing the correct indenting)
volumes:
- plex-config:/nfs/config
- plex-tv:/nfs/tv
- plex-movies:/nfs/movies
- plex-music:/nfs/music
restart: unless-stopped
volumes:
plex-config:
name: config # this is the name of the volume in /var/lib/docker/volumes
driver_opts:
type: "nfs"
o: "addr=10.10.10.110,nolock,soft"
device: ":/export/plex-config"
plex-movies:
name: movies # this is the name of the volume in /var/lib/docker/volumes
driver_opts:
type: "nfs"
o: "addr=10.10.10.110,nolock,soft"
device: ":/export/movies"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.