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

directory does not support NFS #61

Open strauss69400 opened 3 years ago

strauss69400 commented 3 years ago

Hi everyone,

I get this error when i run the container : Impossible to find the solution. i tried many things but without success

In the logs i get this informations:

  STARTING SERVICES ...

================================================================== ----> starting rpcbind ----> starting exportfs exportfs: /home does not support NFS export ----> ----> ERROR: /usr/sbin/exportfs failed ---->

and this is my docker-compose

nfs-server:
  image: erichough/nfs-server
  container_name: nfs-server
  hostname: project
  environment:
    NFS_PORT: 2049
    NFS_VERSION: 3
    #NFS_SERVER_THREAD_COUNT: 8
    NFS_EXPORT_0: /home *(rw,insecure,no_subtree_check,fsid=0,no_root_squash,sync)
  restart: unless-stopped
  volumes:
    - type: bind
      source: /etc
      target: /home
      read_only: false
  cap_add:
    - SYS_ADMIN
    - SYS_MODULE
  privileged: true
  ports:
    - 2049:2049
    - 112:112
    - 32765:32765
    - 32767:32767

Can you help me please ? Best regards

james-mchugh commented 3 years ago

I'm seeing the same issue.

finalspy commented 3 years ago

same for me ...

aaron-pham commented 2 years ago

I found that the NFS share must be mounted to the host as well. So in your docker-compose.yml

volumes:
      - <directory that exist on host>:/home
      - type: bind
         source: /etc
         target: /home
         read_only: false

And this should get rid of the error.

bargergo commented 2 years ago

@aaron-pham Could you show an example with more details? (For example a full docker-compose.yml)

I have tried it like this:

version: "2.1"
services:
  nfs-server:
    image: erichough/nfs-server:2.2.1
    container_name: nfs-server
    privileged: true
    volumes:
      - /F/tusfiles:/home/user/share
      - type: bind
        source: /F/tusfiles
        target: /home/user/share
        read_only: false
      - /F/tusfiles/exports.txt:/etc/exports:ro  
    ports:
      - 2049:2049

But I got this error:

ERROR: Duplicate mount points: [/F/tusfiles:/home/user/share:rw, /F/tusfiles:/home/user/share:rw]

(I get the same error if the source is /etc)

mcclumpherty commented 9 months ago

What if I don't want to have a bind mount to the host? Is there any way to share the folder without doing that?