forked from ehough/docker-nfs-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2238906
commit 6884f5c
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# docker-compose example | ||
|
||
## Introduction | ||
|
||
The example provided [docker-compose file](docker-compose.yml) allows for: | ||
* building the container, | ||
* running the container in `NFS v4` mode only (`NFS v3` is disabled) - see more | ||
in the | ||
[customize NFS versions](../advanced/nfs-versions.md#customize-nfs-versions-offered) | ||
|
||
Following stuff gets mounted into the container: | ||
|
||
* `nfs-export` directory: | ||
|
||
``` | ||
nfs-export | ||
└── debian | ||
├── a | ||
├── b | ||
├── c | ||
└── d | ||
``` | ||
|
||
* `exports.txt` file: | ||
|
||
``` | ||
/export *(rw,fsid=0,no_subtree_check,sync) | ||
/export/debian *(rw,nohide,insecure,no_subtree_check,sync) | ||
``` | ||
|
||
## Build | ||
|
||
In order to build the container: | ||
|
||
``` | ||
docker-compose build | ||
``` | ||
|
||
## Run | ||
|
||
In order to run the container: | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
## Test | ||
|
||
Check if we can mount the directory: | ||
|
||
``` | ||
sudo mount LOCAL_IP:/ /mnt -v | ||
``` | ||
|
||
In the command output we can inspect which `NFS` version was used: | ||
|
||
``` | ||
mount.nfs: timeout set for Thu Jan 31 16:16:20 2019 | ||
mount.nfs: trying text-based options 'vers=4.2,addr=LOCAL_IP,clientaddr=LOCAL_IP' | ||
``` | ||
|
||
Inspect mounted directory content: | ||
|
||
``` | ||
/mnt | ||
└── debian | ||
├── a | ||
├── b | ||
├── c | ||
└── d | ||
``` | ||
|
||
## Possible issues | ||
|
||
In case of the: | ||
|
||
``` | ||
nfs-server | ================================================================== | ||
nfs-server | STARTING SERVICES ... | ||
nfs-server | ================================================================== | ||
nfs-server | ----> mounting rpc_pipefs filesystem onto /var/lib/nfs/rpc_pipefs | ||
nfs-server | mount: mounting rpc_pipefs on /var/lib/nfs/rpc_pipefs failed: Permission denied | ||
nfs-server | ----> | ||
nfs-server | ----> ERROR: unable to mount rpc_pipefs filesystem onto /var/lib/nfs/rpc_pipefs | ||
nfs-server | ----> | ||
``` | ||
|
||
Please refer to the [apparmor document](../feature/apparmor.md#apparmor). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3' | ||
|
||
services: | ||
nfs-server: | ||
build: | ||
context: ../../ | ||
dockerfile: Dockerfile | ||
image: "erichough/nfs-server" | ||
container_name: "nfs-server" | ||
cap_add: | ||
- SYS_ADMIN | ||
ports: | ||
- "2049:2049" | ||
volumes: | ||
- "$PWD/exports.txt:/etc/exports:ro" | ||
- "$PWD/nfs-export:/export" | ||
environment: | ||
NFS_VERSION: 4.2 | ||
NFS_DISABLE_VERSION_3: 1 |