sjiveson / nfs-server-alpine

A handy Alpine Linux based NFS Server image running NFS v4 only, over TCP on port 2049
https://hub.docker.com/r/itsthenetwork/nfs-server-alpine/
GNU General Public License v3.0
295 stars 187 forks source link

Dynamic multiple shared directories #37

Open g0blin79 opened 5 years ago

g0blin79 commented 5 years ago

Feature Request

As specified in the README file, if you want to share more than two directories, you need to add a code snippet in nfsd.sh file, one for each directory you want to share other than first two.

This couldn't be enough in some specific situation, as (for example) if you want to use this docker image as NFS Server in a Google Kubernetes Engine, where using NFS fs is the only (cheeper) way to mount a volume in more than a container replica with ReadWriteMany access type.

Could be useful to handle multiple shared directories dynamically directly in this docker image, avoiding users to create their own Dockerfile.

My proposal is to create a specific environment variables for additional directories other than the first one. Basically, the main shared directory is the most important one, because all other have to be its subdirectories.

For example:

Then, in nfsd.sh, you can fetch all environment variables starting with EXTRA_SHAREDDIRECTORY*, and spool them into /etc/exports file.

g0blin79 commented 5 years ago

Pull request: https://github.com/sjiveson/nfs-server-alpine/pull/38

colearendt commented 2 years ago

Worth discussing whether #38 (using several env vars) or #23 (using / parsing the command) is preferable

A benefit of separate env vars may be potential separate NFS_OPTS per mount 🤷 (Although the PR did not implement this pattern).

A benefit of the command is that the interface / command calling should be easier / simpler / shorter