Deployment of NFS server, to share contents (Docker Swarm volumes) between different hosts
If your Docker host has AppArmor activated, you'll need to perform additional steps to allow the container to start an NFS server.
-
Ensure you have the
apparmor-utils
andlxc
packages installed on the Docker host. e.g. for Debian or Ubuntu:sudo apt-get install apparmor-utils lxc
-
Create a file on the Docker host with the following contents:
#include <tunables/global> profile nfs-server flags=(attach_disconnected,mediate_deleted) { #include <abstractions/lxc/container-base> mount fstype=nfs*, mount fstype=rpc_pipefs, }
-
Load this profile into the kernel with
apparmor_parser
:sudo apparmor_parser -r -W /path/to/file/from/previous/step
-
If profile does not survive reboot, place it at
/etc/apparmor.d/
.