NFS client on LXC seems do not work. Why? The problem is apparmor on the real machine that block any appempt to mount NFS volumes.
In order to try to minimize the security changes on apparmor I add the following lines in/etc/apparmor.d/lxc/lxc-default
# allow nfs mount everywhere
mount fstype=rpc_pipefs,
mount fstype=nfs,
Then
$ /etc/init.d/apparmor reload
And now I was able to restart nfs-common and nfs-kernel-server without errors !
Update!!!!!
nano /etc/apparmor.d/lxc/lxc-default
Update the file as below-
# Do not load this file. Rather, load /etc/apparmor.d/lxc-containers, which
# will source all profiles under /etc/apparmor.d/lxc
profile lxc-container-default flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/lxc/container-base>
# the container may never be allowed to mount devpts. If it does, it
# will remount the host's devpts. We could allow it to do it with
# the newinstance option (but, right now, we don't).
# deny mount fstype=devpts,
# allow nfs mount everywhere
mount fstype=rpc_pipefs,
mount fstype=nfs,
}
sasasa
Now read the other article on how to connect to NFS server from LXC container