title: How to run an Ubuntu NFS V4 kernel server in an Ubuntu docker instance without port mapper?
body: <p>I need to operate a NFS server in docker in pure V4 mode, i.e. without portmapper port 111. (Reason: NFS server in Docker in WSL2 in Windows.)</p>
  <p>I found instructions how to operate the Ubuntu default kernel NFS server without port 111 being open:</p>
  <p>From <a href="https://peteris.rocks/blog/nfs4-single-port/" rel="nofollow noreferrer">https://peteris.rocks/blog/nfs4-single-port/</a></p>
  <pre><code>$ sudo vim /etc/default/nfs-kernel-server
  ...
  RPCMOUNTDOPTS=&quot;--no-nfs-version 2 --no-nfs-version 3 --nfs-version 4 --no-udp&quot;
  RPCNFSDOPTS=&quot;--no-nfs-version 2 --no-nfs-version 3 --nfs-version 4 --no-udp&quot;
  ...
  $ sudo systemctl disable --now rpcbind.service rpcbind.socket
  $ sudo systemctl mask rpcbind.service rpcbind.socket
  </code></pre>
  <p>However, this instructions rely on the commands &quot;systemctl disable/mask&quot; which are not available in my Ubuntu docker image, as there's no systemd or init around naturally in docker. When I exclude versions 2 and 3 in /etc/default/kernel-server and start nfs, I get the error message:</p>
  <pre><code>Not starting: portmapper is not running
  </code></pre>
  <p>Questions:</p>
  <ul>
  <li>How can I run a pure NFS V4 tftp server in docker (Ubuntu) that does not need portmapper / port 111 ?</li>
  <li>How can I do systemctl disable --now rpcbind-service rpcbind-socket and systemctl mask epcbind-service rpcbind.socket when I have no systemctl available ?</li>
  <li>Do I maybe need to patch /etc/init.d/nfs-kernel-server start ?</li>
  <li>Are there better alternatives to nfs-kernel-server for a pure V4 mode ?</li>
  </ul>
  <p>Thanks very much.</p>