ehough / docker-nfs-server

A lightweight, robust, flexible, and containerized NFS server.
https://hub.docker.com/r/erichough/nfs-server/
GNU General Public License v3.0
669 stars 221 forks source link

Accessing the share from an external device #75

Open pdm-pcb opened 1 year ago

pdm-pcb commented 1 year ago

Hello there. I was able to set this container up with ease and confidence, so thank you for that.

I've run into a bit of a knowledge gap though - I'm not sure how to a) ensure devices external to the host (but still on the host's LAN) will be able to access the share, and b) have that functionality working on Windows (10 Pro). At present, my docker-compose.yaml looks like this:

  nfs-server:
    image: erichough/nfs-server
    container_name: nfs-server
#    environment:
#      - NFS_DISABLE_VERSION_3=true
    volumes:
      - /mnt/longjump/media:/nfs
      - /mnt/longjump/docker/container-data/nfs-server/exports.txt:/etc/exports:ro
      - /lib/modules:/lib/modules:ro
    cap_add:
      - SYS_ADMIN
      - SYS_MODULE
    networks:
      - reverse_proxy
    ports:
      - 111:111/udp
      - 2049:2049

If I don't forward :111, I am able to mount it referring to the container's IP from the host, as your readme suggests. And whether or not I permit NFS3, Windows just refuses to cooperate externally. I haven't tried an external Linux client yet, but I have a feeling that'll work just fine.

I originally tried without adding it to the reverse_proxy network, but it went ahead and created its own default network rather than using host or bridge. Obviously I'm least certain of what's right with this parameter specifically. =)

For completeness' sake, here's the command I'm using on Windows (with the NFS feature enabled, of course). mount -o anon \\10.0.0.1\nfs Z: or mount -o anon \\192.168.4.10\nfs Z:

I can SSH from the Windows machine to the server via both of those NICs, so the fundamentals are in order. Or, the fundamentals I understand, anyway. =)

Any pointers would be much appreciated!