Skip to content

Commit 6884f5c

Browse files
committed
Merge PR17
ehough#17
1 parent 2238906 commit 6884f5c

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ If you pay close attention to each of the items in this section, the server shou
157157
* [customizing NFS versions offered](https://github.com/ehough/docker-nfs-server/blob/develop/doc/advanced/nfs-versions.md)
158158
* [performance tuning](https://github.com/ehough/docker-nfs-server/blob/develop/doc/advanced/performance-tuning.md)
159159

160+
## Examples
161+
162+
* [docker-compose](doc/examples/docker-compose.md)
163+
160164
## Help!
161165

162166
Please [open an issue](https://github.com/ehough/docker-nfs-server/issues) if you have any questions, constructive criticism, or can't get something to work.

doc/examples/docker-compose.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# docker-compose example
2+
3+
## Introduction
4+
5+
The example provided [docker-compose file](docker-compose.yml) allows for:
6+
* building the container,
7+
* running the container in `NFS v4` mode only (`NFS v3` is disabled) - see more
8+
in the
9+
[customize NFS versions](../advanced/nfs-versions.md#customize-nfs-versions-offered)
10+
11+
Following stuff gets mounted into the container:
12+
13+
* `nfs-export` directory:
14+
15+
```
16+
nfs-export
17+
└── debian
18+
├── a
19+
├── b
20+
├── c
21+
└── d
22+
```
23+
24+
* `exports.txt` file:
25+
26+
```
27+
/export *(rw,fsid=0,no_subtree_check,sync)
28+
/export/debian *(rw,nohide,insecure,no_subtree_check,sync)
29+
```
30+
31+
## Build
32+
33+
In order to build the container:
34+
35+
```
36+
docker-compose build
37+
```
38+
39+
## Run
40+
41+
In order to run the container:
42+
43+
```
44+
docker-compose up
45+
```
46+
47+
## Test
48+
49+
Check if we can mount the directory:
50+
51+
```
52+
sudo mount LOCAL_IP:/ /mnt -v
53+
```
54+
55+
In the command output we can inspect which `NFS` version was used:
56+
57+
```
58+
mount.nfs: timeout set for Thu Jan 31 16:16:20 2019
59+
mount.nfs: trying text-based options 'vers=4.2,addr=LOCAL_IP,clientaddr=LOCAL_IP'
60+
```
61+
62+
Inspect mounted directory content:
63+
64+
```
65+
/mnt
66+
└── debian
67+
├── a
68+
├── b
69+
├── c
70+
└── d
71+
```
72+
73+
## Possible issues
74+
75+
In case of the:
76+
77+
```
78+
nfs-server | ==================================================================
79+
nfs-server | STARTING SERVICES ...
80+
nfs-server | ==================================================================
81+
nfs-server | ----> mounting rpc_pipefs filesystem onto /var/lib/nfs/rpc_pipefs
82+
nfs-server | mount: mounting rpc_pipefs on /var/lib/nfs/rpc_pipefs failed: Permission denied
83+
nfs-server | ---->
84+
nfs-server | ----> ERROR: unable to mount rpc_pipefs filesystem onto /var/lib/nfs/rpc_pipefs
85+
nfs-server | ---->
86+
```
87+
88+
Please refer to the [apparmor document](../feature/apparmor.md#apparmor).

doc/examples/docker-compose.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3'
2+
3+
services:
4+
nfs-server:
5+
build:
6+
context: ../../
7+
dockerfile: Dockerfile
8+
image: "erichough/nfs-server"
9+
container_name: "nfs-server"
10+
cap_add:
11+
- SYS_ADMIN
12+
ports:
13+
- "2049:2049"
14+
volumes:
15+
- "$PWD/exports.txt:/etc/exports:ro"
16+
- "$PWD/nfs-export:/export"
17+
environment:
18+
NFS_VERSION: 4.2
19+
NFS_DISABLE_VERSION_3: 1

0 commit comments

Comments
 (0)