Search code examples
centoscentos7nfs

want to run exportfs in container, what need to mount into container?


I want to run exportfs -a command, but instead to run directly on host, I want to run in a privileged container on the host. It means I need to mount some files/directories into containers, so exportfs -a will take effect on hosts.

I mount the following:

  • /etc/exports and /etc/exports.d
  • all directories listed in /etc/exports and etc/exports.d
  • /var/lib/nfs/etab

But when I modify /etc/exports and run exportfs -a, nothing changes in /var/lib/nfs/etab

Any ideas? Thanks.


Solution

  • To mount /var/lib/nfs instead of /var/lib/nfs/etab can solve this problem.

    It is a permission issue that /var/lib/nfs should be writable.