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
Copy file name to clipboardexpand all lines: README.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ 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
11
- clean teardown of services upon termination (no lingering `nfsd` processes on Docker host)
11
12
- flexible construction of `/etc/exports`
@@ -40,7 +41,7 @@ This is the only containerized NFS server that offers **all** of the following f
40
41
-`nfs`
41
42
-`nfsd`
42
43
-`rpcsec_gss_krb5` (*only if Kerberos is used*)
43
-
44
+
44
45
Usually you can enable these modules with: `modprobe {nfs,nfsd,rpcsec_gss_krb5}`
45
46
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
47
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 +58,13 @@ Starting the `erichough/nfs-server` image will launch an NFS server. You'll need
57
58
--cap-add SYS_ADMIN \
58
59
-p 2049:2049 \
59
60
erichough/nfs-server
60
-
61
+
61
62
Let's break that command down into its individual pieces to see what's required for a successful server startup.
62
63
63
64
1.**Provide the files to be shared over NFS**
64
65
65
66
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 +81,7 @@ Let's break that command down into its individual pieces to see what's required
80
81
-v /host/path/to/exports.txt:/etc/exports:ro \
81
82
... \
82
83
erichough/nfs-server
83
-
84
+
84
85
1. provide each line of `/etc/exports` as an environment variable
85
86
86
87
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 +104,35 @@ Let's break that command down into its individual pieces to see what's required
103
104
1. **Use `--cap-add SYS_ADMIN` or `--privileged`**
104
105
105
106
As noted in the [requirements](#requirements), the container will need additional privileges. So your `run` command will need *either*:
106
-
107
+
107
108
docker run --cap-add SYS_ADMIN ... erichough/nfs-server
108
109
109
110
or
110
-
111
+
111
112
docker run --privileged ... erichough/nfs-server
112
-
113
+
113
114
Not sure which to use? Go for `--cap-add SYS_ADMIN` as it's the lesser of two evils.
114
115
115
116
1. **Expose the server ports**
116
117
117
118
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
119
119
120
* If your clients connect via **NFSv4 only**, you can get by with just TCP port `2049`:
120
-
121
+
121
122
docker run -p 2049:2049 ... erichough/nfs-server
122
-
123
+
123
124
* If you'd like to support **NFSv3**, you'll need to expose a lot more ports:
124
-
125
+
125
126
docker run \
126
127
-p 2049:2049 -p 2049:2049/udp \
127
128
-p 111:111 -p 111:111/udp \
128
129
-p 32765:32765 -p 32765:32765/udp \
129
130
-p 32767:32767 -p 32767:32767/udp \
130
131
... \
131
132
erichough/nfs-server
132
-
133
+
133
134
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
-
135
+
135
136
### Mounting filesystems from a client
136
137
137
138
# mount <container-IP>:/some/export /some/local/path
@@ -141,7 +142,7 @@ If you pay close attention to each of the items in this section, the server shou
141
142
* [Kerberos security](doc/feature/kerberos.md)
142
143
* [NFSv4 user ID mapping](doc/feature/nfs4-user-id-mapping.md)
143
144
* [AppArmor integration](doc/feature/apparmor.md)
144
-
145
+
145
146
## Advanced
146
147
147
148
* [customizing which ports are used](doc/advanced/ports.md)
@@ -154,7 +155,6 @@ Please [open an issue](https://github.com/ehough/docker-nfs-server/issues) if yo
154
155
155
156
## Remaining tasks
156
157
157
-
- switch to Alpine Linux once `nfs-utils` version 2.3.1-r4 (or higher) is released in a stable repo (maybe Alpine 3.9?). See [this bug](https://bugs.alpinelinux.org/issues/8470) for details
158
158
- figure out why `rpc.nfsd` takes 5 minutes to startup/timeout unless `rpcbind` is running
0 commit comments