-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
265 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Customize NFS versions offered | ||
|
||
By default, this image provides NFS versions 3 and 4 simultaneously. Using the following environment variables, you can fine-tune which versions are offered. | ||
|
||
| Environment variable | Description | Default | | ||
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| | ||
| `NFS_VERSION` | Set to `3`, `4`, `4.1`, or `4.2` to fine tune the NFS protocol version. Enabling any version will also enable any lesser versions. e.g. `4.2` will enable versions 4.2, 4.1, 4, **and** 3. | `4.2` | | ||
| `NFS_DISABLE_VERSION_3` | Set to a non-empty value (e.g. `NFS_DISABLE_VERSION_3=1`) to disable NFS version 3 and run a version-4-only server. This setting is not compatible with `NFS_VERSION=3` | *not set* | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Performance tuning | ||
|
||
The following tips might improve your NFS server's performance. | ||
|
||
* Set the **`NFS_SERVER_THREAD_COUNT`** environment variable to control how many server threads `rpc.nfsd` will use. A good minimum is one thread per CPU core, but 4 or 8 threads per core is probably better. The default is one thread per CPU core. | ||
|
||
* Running the container with `--network host` *might* improve network performance by 10% - 20% [[1](https://jtway.co/docker-network-performance-b95bce32b4b9),[2](https://www.percona.com/blog/2016/08/03/testing-docker-multi-host-network-performance/)], though this hasn't been tested. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Customizing ports | ||
|
||
You can customize the ports used by the NFS server via the environment variables listed below. Each environment variable can be set to an integer between `1` and `65535`. | ||
|
||
| Environment variable | Description | Default | | ||
|----------------------|---------------------------------------------|---------| | ||
| `NFS_PORT` | `rpc.nfsd`'s listening port. | `2049` | | ||
| `NFS_PORT_MOUNTD` | *NFSv3 only*. `rpc.mountd'` listening port. | `32767` | | ||
| `NFS_PORT_STATD_IN` | *NFSv3 only*. `rpc.statd`'s listening port. | `32765` | | ||
| `NFS_PORT_STATD_OUT` | *NFSv3 only*. `rpc.statd`'s outgoing port. | `32766` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# AppArmor | ||
|
||
If your Docker host has [AppArmor](https://wiki.ubuntu.com/AppArmor) activated, you'll need to perform additional steps to allow the container to start an NFS server. | ||
|
||
1. Ensure you have the `apparmor-utils` installed package installed on the Docker host. e.g. for Debian or Ubuntu: | ||
|
||
$ sudo apt-get install apparmor-utils | ||
|
||
1. Create a file on the Docker host with the following contents: | ||
|
||
#include <tunables/global> | ||
profile erichough-nfs flags=(attach_disconnected,mediate_deleted) { | ||
#include <abstractions/lxc/container-base> | ||
mount fstype=nfs*, | ||
mount fstype=rpc_pipefs, | ||
} | ||
1. Load this profile into the kernel with [`apparmor_parser`](http://manpages.ubuntu.com/manpages/xenial/man8/apparmor_parser.8.html): | ||
|
||
$ sudo apparmor_parser -r -W /path/to/file/from/previous/step | ||
|
||
1. Add `--security-opt apparmor=erichough-nfs` to your `docker run` command. e.g. | ||
|
||
docker run \ | ||
-v /path/to/share:/nfs \ | ||
-v /path/to/exports.txt:/etc/exports:ro \ | ||
--cap-add SYS_ADMIN \ | ||
-p 2049:2049 \ | ||
--security-opt apparmor=erichough-nfs \ | ||
erichough/nfs-server | ||
or in `docker-compose.yml`: | ||
|
||
```YAML | ||
version: 3 | ||
services: | ||
nfs: | ||
image: erichough/nfs-server | ||
volumes: | ||
- /path/to/share:/nfs | ||
- /path/to/exports.txt:/etc/exports:ro | ||
cap_add: | ||
- SYS_ADMIN | ||
ports: | ||
- 2049:2049 | ||
security_opt: | ||
- apparmor=erichough-nfs | ||
``` |
Oops, something went wrong.