Mounting nfs shares inside docker container

后端 未结 5 1228
死守一世寂寞
死守一世寂寞 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:06

    By adding --cap-add sys_admin flag to client container wasn't enough for me. I was getting error:

    mount.nfs: mount(2): Permission denied
    mount.nfs: access denied by server while mounting 1.2.3.4:/exports
    

    After hours of research I've found that it looks like full privilege --privileged is needed to mount correctly inside docker container ..

    Also don't forget to install necessary nfs client packages inside your docker container. On debian based containers:

    apt-get install -y nfs-common
    

提交回复
热议问题