Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to provide for Docker Volume ? #87

Open
seepine opened this issue Jul 18, 2024 · 1 comment
Open

How to provide for Docker Volume ? #87

seepine opened this issue Jul 18, 2024 · 1 comment

Comments

@seepine
Copy link

seepine commented Jul 18, 2024

I'm sorry, I can't find where the problem is, and I can only seek help here.

Nfs Server with docker-compose

In ubuntu24 server 192.168.100.134

services:
  nfs-server:
    image: erichough/nfs-server
    ports:
      - '2049:2049'
      - '2049:2049/udp'
      - '111:111'
      - '111:111/udp'
      - '32765:32765'
      - '32765:32765/udp'
      - '32767:32767'
      - '32767:32767/udp'
    privileged: true
    cap_add:
      - SYS_ADMIN
    environment:
      - NFS_EXPORT_0=/nfs *(rw,insecure,sync,all_squash,no_subtree_check)
    volumes:
      - './data:/nfs'

And the log

$ docker compose up 
[+] Running 1/0
 ✔ Container nfs-nfs-server-1  Created                                                                              0.0s 
Attaching to nfs-server-1
nfs-server-1  | 
nfs-server-1  | ==================================================================
nfs-server-1  |       SETTING UP ...
nfs-server-1  | ==================================================================
nfs-server-1  | ----> setup complete
nfs-server-1  | 
nfs-server-1  | ==================================================================
nfs-server-1  |       STARTING SERVICES ...
nfs-server-1  | ==================================================================
nfs-server-1  | ----> starting rpcbind
nfs-server-1  | ----> starting exportfs
nfs-server-1  | ----> starting rpc.mountd on port 32767
nfs-server-1  | ----> starting rpc.statd on port 32765 (outgoing from port 32766)
nfs-server-1  | ----> starting rpc.nfsd on port 2049 with 8 server thread(s)
nfs-server-1  | ----> all services started normally
nfs-server-1  | 
nfs-server-1  | ==================================================================
nfs-server-1  |       SERVER STARTUP COMPLETE
nfs-server-1  | ==================================================================
nfs-server-1  | ----> list of enabled NFS protocol versions: 4.2, 4.1, 4, 3
nfs-server-1  | ----> list of container exports:
nfs-server-1  | ---->   /nfs *(rw,insecure,sync,no_root_squash,no_subtree_check,fsid=1)
nfs-server-1  | ----> list of container ports that should be exposed:
nfs-server-1  | ---->   111 (TCP and UDP)
nfs-server-1  | ---->   2049 (TCP and UDP)
nfs-server-1  | ---->   32765 (TCP and UDP)
nfs-server-1  | ---->   32767 (TCP and UDP)
nfs-server-1  | 
nfs-server-1  | ==================================================================
nfs-server-1  |       READY AND WAITING FOR NFS CLIENT CONNECTIONS
nfs-server-1  | ==================================================================

For docker volume

version: '3.9'
services:
  db:
    image: postgres:16
    restart: unless-stopped
    ports:
      - 5432:5432
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres

volumes:
  postgres_data:
    driver: local
    driver_opts:
      type: "nfs"
      o: "addr=192.168.100.134,nolock,soft,rw"
      device: ":/nfs"

But i got error msg

failed to populate volume: error while mounting volume '/var/lib/docker/volumes/postgres_postgres_data/_data': failed to mount local volume: mount :/:/var/lib/docker/volumes/postgres_postgres_data/_data, data: addr=192.168.100.134: permission denied
@seepine
Copy link
Author

seepine commented Jul 18, 2024

Try mount

$ sudo mount -v -t nfs -o rw,vers=3,nolock,proto=udp,port=2049 196.168.100.134:/nfs/nas ./nas_dir
mount.nfs: timeout set for Thu Jul 18 16:01:37 2024
mount.nfs: trying text-based options 'vers=3,nolock,proto=udp,port=2049,addr=196.168.100.134'
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Timed out
$ sudo mount -v -t nfs -o rw,vers=4,nolock,proto=udp,port=2049 196.168.100.134:/nfs/nas ./nas_dir
mount.nfs: timeout set for Thu Jul 18 16:04:39 2024
mount.nfs: trying text-based options 'nolock,proto=udp,port=2049,vers=4.2,addr=196.168.100.134,clientaddr=192.168.100.131'
mount.nfs: mount(2): Invalid argument
mount.nfs: trying text-based options 'nolock,proto=udp,port=2049,vers=4,minorversion=1,addr=196.168.100.134,clientaddr=192.168.100.131'
mount.nfs: mount(2): Invalid argument
mount.nfs: trying text-based options 'nolock,proto=udp,port=2049,vers=4,addr=196.168.100.134,clientaddr=192.168.100.131'
mount.nfs: mount(2): Invalid argument
mount.nfs: an incorrect mount option was specified for /home/seepine/nas_dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant