All Projects → ehough → Docker Nfs Server

ehough / Docker Nfs Server

Licence: gpl-3.0
A lightweight, robust, flexible, and containerized NFS server.

Programming Languages

shell
77523 projects

Labels

Projects that are alternatives of or similar to Docker Nfs Server

unfs3
UNFS3 is a user-space implementation of the NFSv3 server specification.
Stars: ✭ 74 (-80.73%)
Mutual labels:  nfs
docker-machine-mac-nfs-mount
Docker machine Mac OS X nfs mount
Stars: ✭ 17 (-95.57%)
Mutual labels:  nfs
docker-volume-plugins
Managed docker volume plugins
Stars: ✭ 126 (-67.19%)
Mutual labels:  nfs
csi-nfs
A Container Storage Interface (CSI) plug-in that provides network file system (NFS) support.
Stars: ✭ 32 (-91.67%)
Mutual labels:  nfs
terraform-aws-efs-backup
Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
Stars: ✭ 40 (-89.58%)
Mutual labels:  nfs
magento2-fast-vm
Optimal vagrant developer box for Magento2. Folders synced by nfs/rsync. This box includes Magento developer utilities.
Stars: ✭ 89 (-76.82%)
Mutual labels:  nfs
magento2-ansible-vagrant
Ⓜ️2️⃣ Ansible provisioned Ubuntu 16.04 vagrant box for Magento2 development.
Stars: ✭ 25 (-93.49%)
Mutual labels:  nfs
Go Nfs
golang NFSv3 server
Stars: ✭ 361 (-5.99%)
Mutual labels:  nfs
fuse-nfs-crossbuild-scripts
fuse-nfs for windows using dokany
Stars: ✭ 35 (-90.89%)
Mutual labels:  nfs
ioBroker.backitup
Backitup enables the cyclical creation of backups of an IoBroker / Homematic installation
Stars: ✭ 43 (-88.8%)
Mutual labels:  nfs
nfsdtop
Display top I/O on NFS servers using bpftrace on Linux and DTrace on FreeBSD
Stars: ✭ 27 (-92.97%)
Mutual labels:  nfs
RPCScan
Tool to communicate with RPC services and check misconfigurations on NFS shares
Stars: ✭ 53 (-86.2%)
Mutual labels:  nfs
silverbox
Guide describing how to setup compact, silent and energy-efficient GNU/Linux home server
Stars: ✭ 42 (-89.06%)
Mutual labels:  nfs
docker-nfs4
Simple containerized NFS v4 server running on Alpine Linux
Stars: ✭ 19 (-95.05%)
Mutual labels:  nfs
csi-driver-nfs
This driver allows Kubernetes to access NFS server on Linux node.
Stars: ✭ 227 (-40.89%)
Mutual labels:  nfs
jupyterhub-deploy-swarm
A DockerSwarm Jupyterhub setup, which uses a NFS Server running in a Docker Container for persistent storage
Stars: ✭ 19 (-95.05%)
Mutual labels:  nfs
docker-nfs-server
No description or website provided.
Stars: ✭ 31 (-91.93%)
Mutual labels:  nfs
Infinit
The Infinit policy-based software-defined storage platform.
Stars: ✭ 363 (-5.47%)
Mutual labels:  nfs
Edgefs
EdgeFS - decentralized, scalable data fabric platform for Edge/IoT Computing and Kubernetes apps
Stars: ✭ 358 (-6.77%)
Mutual labels:  nfs
mobymac
Automagically install Docker in a VirtualBox VM with super-fast NFS mounts.
Stars: ✭ 79 (-79.43%)
Mutual labels:  nfs

erichough/nfs-server

A lightweight, robust, flexible, and containerized NFS server.

Why?

This is the only containerized NFS server that offers all of the following features:

  • small (~15MB) Alpine Linux image
  • NFS versions 3, 4, or both simultaneously
  • clean teardown of services upon termination (no lingering nfsd processes on Docker host)
  • flexible construction of /etc/exports
  • extensive server configuration via environment variables
  • human-readable logging (with a helpful debug mode)
  • optional bonus features

Table of Contents

Requirements

  1. The Docker host kernel will need the following kernel modules

    • nfs
    • nfsd
    • rpcsec_gss_krb5 (only if Kerberos is used)

    You can manually enable these modules on the Docker host with:

    modprobe {nfs,nfsd,rpcsec_gss_krb5}

    or you can just allow the container to load them automatically.

  2. The container will need to run with CAP_SYS_ADMIN (or --privileged). This is necessary as the server needs to mount several filesystems inside the container to support its operation, and performing mounts from inside a container is impossible without these capabilities.

  3. The container will need local access to the files you'd like to serve via NFS. You can use Docker volumes, bind mounts, files baked into a custom image, or virtually any other means of supplying files to a Docker container.

Usage

Starting the server

Starting the erichough/nfs-server image will launch an NFS server. You'll need to supply some information upon container startup, which we'll cover below, but briefly speaking your docker run command might look something like this:

docker run                                            \
  -v /host/path/to/shared/files:/some/container/path  \
  -v /host/path/to/exports.txt:/etc/exports:ro        \
  --cap-add SYS_ADMIN                                 \
  -p 2049:2049                                        \
  erichough/nfs-server

Let's break that command down into its individual pieces to see what's required for a successful server startup.

  1. Provide the files to be shared over NFS

    As noted in the requirements, the container will need local access to the files you'd like to share over NFS. Some ideas for supplying these files:

    • bind mounts (-v /host/path/to/shared/files:/some/container/path)
    • volumes (-v some_volume:/some/container/path)
    • files baked into custom image (e.g. in a Dockerfile: COPY /host/files /some/container/path)

    You may use any combination of the above, or any other means to supply files to the container.

  2. Provide your desired NFS exports (/etc/exports)

    You'll need to tell the server which container directories to share. You have three options for this; choose whichever one you prefer:

    1. bind mount /etc/exports into the container

      docker run                                      \
        -v /host/path/to/exports.txt:/etc/exports:ro  \
        ...                                           \
        erichough/nfs-server
      
    2. provide each line of /etc/exports as an environment variable

      The container will look for environment variables that start with NFS_EXPORT_ and end with an integer. e.g. NFS_EXPORT_0, NFS_EXPORT_1, etc.

      docker run                                                                       \
        -e NFS_EXPORT_0='/container/path/foo                  *(ro,no_subtree_check)'  \
        -e NFS_EXPORT_1='/container/path/bar 123.123.123.123/32(rw,no_subtree_check)'  \
        ...                                                                            \
        erichough/nfs-server
      
    3. bake /etc/exports into a custom image

      e.g. in a Dockerfile:

      FROM erichough/nfs-server
      ADD /host/path/to/exports.txt /etc/exports
      
  3. Use --cap-add SYS_ADMIN or --privileged

    As noted in the requirements, the container will need additional privileges. So your run command will need either:

    docker run --cap-add SYS_ADMIN ... erichough/nfs-server
    

    or

    docker run --privileged ... erichough/nfs-server
    

    Not sure which to use? Go for --cap-add SYS_ADMIN as it's the lesser of two evils.

  4. Expose the server ports

    You'll need to open up at least one server port for your client connections. The ports listed in the examples below are the defaults used by this image and most can be customized.

    • If your clients connect via NFSv4 only, you can get by with just TCP port 2049:

      docker run -p 2049:2049 ... erichough/nfs-server
      
    • If you'd like to support NFSv3, you'll need to expose a lot more ports:

      docker run                          \
        -p 2049:2049   -p 2049:2049/udp   \
        -p 111:111     -p 111:111/udp     \
        -p 32765:32765 -p 32765:32765/udp \
        -p 32767:32767 -p 32767:32767/udp \
        ...                               \
        erichough/nfs-server
      

If you pay close attention to each of the items in this section, the server should start quickly and be ready to accept your NFS clients.

Mounting filesystems from a client

# mount <container-IP>:/some/export /some/local/path

Optional Features

Advanced

Help!

Please open an issue if you have any questions, constructive criticism, or can't get something to work.

Remaining tasks

Acknowledgements

This work was based on prior projects:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].