Beany386
Beany386

Reputation: 56

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...

Overview:

Running OMV 6 on standalone PC, another standalone PC running proxmox with Ubunutu VM with docker.

Goal: get NFS shares working on Ubuntu VM so I can spin up docker containers using the NFS shares as volumes

OMV 6 - 10.10.10.110 (myvault)

setup NFS shares as follows all via the GUI, just looking at CLI for simplicity

when i go into /export/movies I can see all the files I expect to

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

VM - Ubuntu 22.04 with docker 10.10.10.161 (docker-pve)

NFS shares can be seen from 161 i.e. docker host...

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

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...

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?

I expected to see all the files I saw before from the other pc when I went to /export/movies

Then running a test docker container...

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

Upvotes: 1

Views: 2552

Answers (1)

Beany386
Beany386

Reputation: 56

Seems issue was 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 i.e. 1 or all 4 disks of the pool may or may not have that folder on them...

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...

So the following docker-compose in a portainer stacks editor works ...

... (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"

Upvotes: 1

Related Questions