You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 6, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ A lightweight, robust, flexible, and containerized NFS server.
6
6
7
7
This is the only containerized NFS server that offers **all** of the following features:
8
8
9
+
- small (~15MB) Alpine Linux image
9
10
- NFS versions 3, 4, or both simultaneously
10
-
- small (< 15MB) Alpine Linux image
11
11
- clean teardown of services upon termination (no lingering `nfsd` processes on Docker host)
12
12
- flexible construction of `/etc/exports`
13
13
- extensive server configuration via environment variables
@@ -40,7 +40,7 @@ This is the only containerized NFS server that offers **all** of the following f
40
40
-`nfs`
41
41
-`nfsd`
42
42
-`rpcsec_gss_krb5` (*only if Kerberos is used*)
43
-
43
+
44
44
Usually you can enable these modules with: `modprobe {nfs,nfsd,rpcsec_gss_krb5}`
45
45
1. 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.
46
46
1. 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.
@@ -57,13 +57,13 @@ Starting the `erichough/nfs-server` image will launch an NFS server. You'll need
57
57
--cap-add SYS_ADMIN \
58
58
-p 2049:2049 \
59
59
erichough/nfs-server
60
-
60
+
61
61
Let's break that command down into its individual pieces to see what's required for a successful server startup.
62
62
63
63
1.**Provide the files to be shared over NFS**
64
64
65
65
As noted in the [requirements](#requirements), the container will need local access to the files you'd like to share over NFS. Some ideas for supplying these files:
* files [baked into](https://docs.docker.com/engine/reference/builder/#copy) custom image (e.g. in a `Dockerfile`: `COPY /host/files /some/container/path`)
@@ -80,7 +80,7 @@ Let's break that command down into its individual pieces to see what's required
80
80
-v /host/path/to/exports.txt:/etc/exports:ro \
81
81
... \
82
82
erichough/nfs-server
83
-
83
+
84
84
1. provide each line of `/etc/exports` as an environment variable
85
85
86
86
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.
@@ -103,35 +103,35 @@ Let's break that command down into its individual pieces to see what's required
103
103
1. **Use `--cap-add SYS_ADMIN` or `--privileged`**
104
104
105
105
As noted in the [requirements](#requirements), the container will need additional privileges. So your `run` command will need *either*:
106
-
106
+
107
107
docker run --cap-add SYS_ADMIN ... erichough/nfs-server
108
108
109
109
or
110
-
110
+
111
111
docker run --privileged ... erichough/nfs-server
112
-
112
+
113
113
Not sure which to use? Go for `--cap-add SYS_ADMIN` as it's the lesser of two evils.
114
114
115
115
1. **Expose the server ports**
116
116
117
117
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](doc/ports.md).
118
118
119
119
* If your clients connect via **NFSv4 only**, you can get by with just TCP port `2049`:
120
-
120
+
121
121
docker run -p 2049:2049 ... erichough/nfs-server
122
-
122
+
123
123
* If you'd like to support **NFSv3**, you'll need to expose a lot more ports:
124
-
124
+
125
125
docker run \
126
126
-p 2049:2049 -p 2049:2049/udp \
127
127
-p 111:111 -p 111:111/udp \
128
128
-p 32765:32765 -p 32765:32765/udp \
129
129
-p 32767:32767 -p 32767:32767/udp \
130
130
... \
131
131
erichough/nfs-server
132
-
132
+
133
133
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.
134
-
134
+
135
135
### Mounting filesystems from a client
136
136
137
137
# mount <container-IP>:/some/export /some/local/path
@@ -141,7 +141,7 @@ If you pay close attention to each of the items in this section, the server shou
141
141
* [Kerberos security](doc/feature/kerberos.md)
142
142
* [NFSv4 user ID mapping](doc/feature/nfs4-user-id-mapping.md)
143
143
* [AppArmor integration](doc/feature/apparmor.md)
144
-
144
+
145
145
## Advanced
146
146
147
147
* [customizing which ports are used](doc/advanced/ports.md)
0 commit comments