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