Mounting nfs shares inside docker container

后端 未结 5 1226
死守一世寂寞
死守一世寂寞 2020-12-02 12:15

Does anyone know how to mount nfs share inside docker container with centos base image? I\'ve tried this command:

mount server:/dir /mount/point
5条回答
  •  生来不讨喜
    2020-12-02 13:05

    I mount the nfs on docker container, thanks for @helmbert .

    1. Run a docker container with the --privileged=true flag.

      $ docker run -it --privileged=true centos:7 bash
      [root@f7915ae635aa /]# yum install -y nfs-utils
      
    2. Install the nfs tool package and mount nfs on CentOS.

      [root@f7915ae635aa /]# yum install -y nfs-utils
      [root@f7915ae635aa /]# mount -t nfs example.tw:/target/ /srv -o nolock
      
    3. Show mount of the nfs server.

      [root@f7915ae635aa /]# showmount example.tw
      Hosts on example.tw:
      10.10.10.1
      10.10.10.2
      

提交回复
热议问题