Skip to content

Commit

Permalink
Merge PR17
Browse files Browse the repository at this point in the history
  • Loading branch information
llabordehpe committed Jan 20, 2023
1 parent 2238906 commit 6884f5c
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ If you pay close attention to each of the items in this section, the server shou
* [customizing NFS versions offered](https://github.com/ehough/docker-nfs-server/blob/develop/doc/advanced/nfs-versions.md)
* [performance tuning](https://github.com/ehough/docker-nfs-server/blob/develop/doc/advanced/performance-tuning.md)

## Examples

* [docker-compose](doc/examples/docker-compose.md)

## Help!

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.
Expand Down
88 changes: 88 additions & 0 deletions doc/examples/docker-compose.md
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).
19 changes: 19 additions & 0 deletions doc/examples/docker-compose.yml
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

0 comments on commit 6884f5c

Please sign in to comment.