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
672 stars 221 forks source link

Question - nfs module is not loaded on the Docker host's kernel (try: modprobe nfs) #1

Closed MichelDiz closed 6 years ago

MichelDiz commented 6 years ago

I'm trying to up run this image to create an NFS server next to RancherOS. Rancher OS is a whole Docker-based operating system. There is a Linux Kernel, but I do not know if the limitations of being a Docker-based system can cause a problem here.

I'm raising your image on the system itself - in Docker built in OS (not Rancher), to use inside the Rancher platform (an orchestrator).

I'm doing this only as testing and learning view.

I am having problems with persistence of data next to this operating system. In fact there is how to persist manualy, but not from the Rancher platform to the Rancher OS. So, as Rancher supports NFS, I thought of that solution (NFS Server) and found your project.

Given this context, I would like to know if you can tell me where my error is or if it is a support problem for the operating system itself.

Cheers

docker run                                                            \
  -e NFS_EXPORT_0='/nfs/dgraph 192.168.25.0/24(rw,no_subtree_check)'      \
  -v /host/Dgraph:/nfs/dgraph                                          \
  --cap-add SYS_ADMIN                                                 \
--privileged                                                       \
  -p 2049:2049                                                        \
  erichough/nfs-server:latest
==================================================================
      SETTING UP
==================================================================
----> building /etc/exports
----> will export /nfs/dgraph 192.168.25.0/24(rw,no_subtree_check)
----> will export 1 filesystem(s)
----> checking for presence of kernel module: nfs
----> nfs module is not loaded on the Docker host's kernel (try: modprobe nfs)
ehough commented 6 years ago

Thanks for your question. I'm not personally familiar with RancherOS, but my understanding is that it uses a vanilla Linux kernel and therefore should work just fine with this image. We'll just need to get the proper kernel modules loaded.

I think the solution might be to load the kernel-extras package as described in this article. If I were you I would try the following commands:

$ sudo ros service enable kernel-extras
$ sudo ros service up kernel-extras
$ sudo modprobe nfs
$ sudo modprobe nfsd
$ docker run                                                           \
  -e NFS_EXPORT_0='/nfs/dgraph 192.168.25.0/24(rw,no_subtree_check)'   \
  -v /host/Dgraph:/nfs/dgraph                                          \
  --cap-add SYS_ADMIN                                                  \
  -p 2049:2049                                                         \
  erichough/nfs-server:latest

In theory this would load the nfs and nfsd kernel modules and you'll be all set. Give that a try?

ehough commented 6 years ago

Were you able to get things working? Please let us know.

Tidying up and closing this issue but feel free to re-open.

MichelDiz commented 6 years ago

Hey, sorry for the delay. I had some setbacks.

I started migrating to Rancher 2.0, they are using kubernetes now. I'm going to test your solution soon, but right now I'm using a solution from kubernetes-incubator. Called "nfs-provisioner", it is temporarily saving me. But I have seen that it will be discontinued.

Cheers!

ivanxx commented 5 years ago

Hi there, I can confirm this works on RancherOS 2.0. You only need to modprobe nfs and nfsd prior to lauch the docker image. I'm looking for a way to get those modules loaded on boot (I suppose this is done from the cloud-config.yml or ros config utility)