并得到下一个错误:
mount .nfs:rpc.statd没有运行,但是远程锁定是必需的。 mount.nfs:使用'-o nolock'来保持锁定本地或开始状态。 mount.nfs:指定了错误的挂载选项
当我尝试使用 -o nolock 选项时,错误是:
mount.nfs:不允许操作解决方案
对于使用 mount ,您需要 CAP_SYS_ADMIN 功能,Docker在创建容器时将其删除。 / p>
有几种解决方案:
将NFS共享挂载在主机上,并将其作为主机卷传递到容器中:
你@主机> mount服务器:/ dir / path / to / mount / point 你@主机> docker运行-v / path / to / mount / point:/ path / to / mount / point
使用Docker卷插件(如 Netshare 插件)直接安装NFS分享为容器卷:
你@主机> docker运行\ --volume-driver = nfs \ -v server / dir:/ path / to / mount / point \ centos
Does anyone know how to mount nfs share inside docker container with centos base image? I've tried this command:
mount server:/dir /mount/pointand got the next error:
mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd. mount.nfs: an incorrect mount option was specified
when I try to use it with -o nolock option, the error is:
mount.nfs: Operation not permitted解决方案
For using mount, you'll need the CAP_SYS_ADMIN capability, which is dropped by Docker when creating the container.
There are several solutions for this:
Mount the NFS share on the host and pass it into the container as a host volume:
you@host > mount server:/dir /path/to/mount/point you@host > docker run -v /path/to/mount/point:/path/to/mount/pointUse a Docker volume plugin (like the Netshare plugin) to directly mount the NFS share as a container volume:
you@host > docker run \ --volume-driver=nfs \ -v server/dir:/path/to/mount/point \ centos
更多推荐
在docker容器内安装nfs共享
发布评论