【问题标题】:How to run an Ubuntu NFS V4 kernel server in an Ubuntu docker instance without port mapper?如何在没有端口映射器的 Ubuntu docker 实例中运行 Ubuntu NFS V4 内核服务器?
【发布时间】:2020-06-25 13:37:39
【问题描述】:

我需要在docker中以纯V4模式运行NFS服务器,即没有portmapper端口111。(原因:Windows WSL2中Docker中的NFS服务器。)

我找到了如何在不打开端口 111 的情况下操作 Ubuntu 默认内核 NFS 服务器的说明:

来自https://peteris.rocks/blog/nfs4-single-port/

$ sudo vim /etc/default/nfs-kernel-server
...
RPCMOUNTDOPTS="--no-nfs-version 2 --no-nfs-version 3 --nfs-version 4 --no-udp"
RPCNFSDOPTS="--no-nfs-version 2 --no-nfs-version 3 --nfs-version 4 --no-udp"
...
$ sudo systemctl disable --now rpcbind.service rpcbind.socket
$ sudo systemctl mask rpcbind.service rpcbind.socket

但是,此说明依赖于我的 Ubuntu docker 映像中不可用的命令“systemctl disable/mask”,因为 docker 中自然没有 systemd 或 init。当我在 /etc/default/kernel-server 中排除版本 2 和 3 并启动 nfs 时,我收到错误消息:

Not starting: portmapper is not running

问题:

  • 如何在不需要端口映射器/端口 111 的 docker (Ubuntu) 中运行纯 NFS V4 tftp 服务器?
  • 当我没有可用的 systemctl 时,如何执行 systemctl disable --now rpcbind-service rpcbind-socket 和 systemctl mask epcbind-service rpcbind.socket ?
  • 我可能需要修补 /etc/init.d/nfs-kernel-server start 吗?
  • 对于纯 V4 模式,是否有比 nfs-kernel-server 更好的替代方案?

非常感谢。

【问题讨论】:

    标签: linux docker windows-subsystem-for-linux nfs


    【解决方案1】:

    解决方案:

    A) 在初始化脚本中禁用对 rpcbind 的检查

    sudo vim /etc/init.d/nfs-kernel-server
    

    去掉#See if rpcbind is running ... if ...fi附近的8行

    B) 启动摇杆运行时使用--privileged

    【讨论】:

      猜你喜欢
      • 2016-01-26
      • 1970-01-01
      • 2022-10-09
      • 1970-01-01
      • 1970-01-01
      • 2021-11-24
      • 1970-01-01
      • 1970-01-01
      • 2012-04-27
      相关资源
      最近更新 更多