diff --git a/README.md b/README.md index 1b46ac9..03daf66 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/doc/examples/docker-compose.md b/doc/examples/docker-compose.md new file mode 100644 index 0000000..13581e3 --- /dev/null +++ b/doc/examples/docker-compose.md @@ -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). \ No newline at end of file diff --git a/doc/examples/docker-compose.yml b/doc/examples/docker-compose.yml new file mode 100644 index 0000000..a121d4c --- /dev/null +++ b/doc/examples/docker-compose.yml @@ -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