Skip to content

Commit b94f257

Browse files
committed
Merge branch 'develop'
2 parents b9082f4 + 43808e1 commit b94f257

File tree

4 files changed

+90
-69
lines changed

4 files changed

+90
-69
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.0.0] - 2019-01-31
8+
9+
### Changed
10+
* Switch to Alpine Linux
11+
712
## [1.2.0] - 2018-09-26
813

914
### Added

Dockerfile

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
# Alpine can only be used if/when this bug is fixed: https://bugs.alpinelinux.org/issues/8470
2-
ARG BUILD_FROM=debian:stretch-slim
1+
ARG BUILD_FROM=alpine:latest
32

43
FROM $BUILD_FROM
54

6-
# https://github.com/ehough/docker-nfs-server/pull/3#issuecomment-387880692
7-
ARG DEBIAN_FRONTEND=noninteractive
8-
9-
# kmod is needed for lsmod, and libcap2-bin is needed for confirming Linux capabilities
10-
RUN apt-get update && \
11-
apt-get install -y --no-install-recommends nfs-kernel-server kmod libcap2-bin && \
12-
apt-get clean && \
13-
rm -rf /var/lib/apt/lists && \
14-
\
5+
RUN apk --update --no-cache add bash nfs-utils && \
6+
\
157
# remove the default config files
168
rm -v /etc/idmapd.conf /etc/exports
179

1810
# http://wiki.linux-nfs.org/wiki/index.php/Nfsv4_configuration
19-
RUN mkdir -p /var/lib/nfs/rpc_pipefs && \
20-
mkdir -p /var/lib/nfs/v4recovery && \
11+
RUN mkdir -p /var/lib/nfs/rpc_pipefs && \
12+
mkdir -p /var/lib/nfs/v4recovery && \
2113
echo "rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0" >> /etc/fstab && \
2214
echo "nfsd /proc/fs/nfsd nfsd defaults 0 0" >> /etc/fstab
2315

README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A lightweight, robust, flexible, and containerized NFS server.
66

77
This is the only containerized NFS server that offers **all** of the following features:
88

9+
- small (~15MB) Alpine Linux image
910
- NFS versions 3, 4, or both simultaneously
1011
- clean teardown of services upon termination (no lingering `nfsd` processes on Docker host)
1112
- flexible construction of `/etc/exports`
@@ -40,7 +41,7 @@ This is the only containerized NFS server that offers **all** of the following f
4041
- `nfs`
4142
- `nfsd`
4243
- `rpcsec_gss_krb5` (*only if Kerberos is used*)
43-
44+
4445
Usually you can enable these modules with: `modprobe {nfs,nfsd,rpcsec_gss_krb5}`
4546
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.
4647
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
5758
--cap-add SYS_ADMIN \
5859
-p 2049:2049 \
5960
erichough/nfs-server
60-
61+
6162
Let's break that command down into its individual pieces to see what's required for a successful server startup.
6263

6364
1. **Provide the files to be shared over NFS**
6465

6566
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:
66-
67+
6768
* [bind mounts](https://docs.docker.com/storage/bind-mounts/) (`-v /host/path/to/shared/files:/some/container/path`)
6869
* [volumes](https://docs.docker.com/storage/volumes/) (`-v some_volume:/some/container/path`)
6970
* 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
8081
-v /host/path/to/exports.txt:/etc/exports:ro \
8182
... \
8283
erichough/nfs-server
83-
84+
8485
1. provide each line of `/etc/exports` as an environment variable
8586

8687
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
103104
1. **Use `--cap-add SYS_ADMIN` or `--privileged`**
104105

105106
As noted in the [requirements](#requirements), the container will need additional privileges. So your `run` command will need *either*:
106-
107+
107108
docker run --cap-add SYS_ADMIN ... erichough/nfs-server
108109

109110
or
110-
111+
111112
docker run --privileged ... erichough/nfs-server
112-
113+
113114
Not sure which to use? Go for `--cap-add SYS_ADMIN` as it's the lesser of two evils.
114115
115116
1. **Expose the server ports**
116117
117118
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).
118119

119120
* If your clients connect via **NFSv4 only**, you can get by with just TCP port `2049`:
120-
121+
121122
docker run -p 2049:2049 ... erichough/nfs-server
122-
123+
123124
* If you'd like to support **NFSv3**, you'll need to expose a lot more ports:
124-
125+
125126
docker run \
126127
-p 2049:2049 -p 2049:2049/udp \
127128
-p 111:111 -p 111:111/udp \
128129
-p 32765:32765 -p 32765:32765/udp \
129130
-p 32767:32767 -p 32767:32767/udp \
130131
... \
131132
erichough/nfs-server
132-
133+
133134
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+
135136
### Mounting filesystems from a client
136137

137138
# 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
141142
* [Kerberos security](doc/feature/kerberos.md)
142143
* [NFSv4 user ID mapping](doc/feature/nfs4-user-id-mapping.md)
143144
* [AppArmor integration](doc/feature/apparmor.md)
144-
145+
145146
## Advanced
146147

147148
* [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
154155
155156
## Remaining tasks
156157
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
158158
- figure out why `rpc.nfsd` takes 5 minutes to startup/timeout unless `rpcbind` is running
159159
- add more examples, including Docker Compose
160160

0 commit comments

Comments
 (0)