首先,安装 rpcbind 和 nfs-utils
yum install -y rpcbind nfs-utils
然后,编辑 /etc/exports
配置 NFS 共享目录,示例:
[root@VM_0_5_centos ~]# cat /etc/exports
/root/share *(rw,sync,all_squash,anonuid=0,anongid=0)
更多详细配置参考 https://www.centos.bz/2017/07/centos7-1-install-nfs/
启动 rpcbind 和 nfs
sudo service rpcbind startsudo service nfs start
查看共享的目录
exportfs
修改配置文件后,重新加载配置文件
exportfs -vr
视频演示:https://www.youtube.com/watch?v=_4XudYZ6M_k
docker volume create --driver local \--opt type=nfs \--opt o=addr=<NFS-Server>,rw \--opt device=:<Shared-Path> \share
docker service create \--mount type=volume,source=<Volume-Name>,destination=<Container-Path> \--replicas 2 \<Image>
注意读写分离,避免多写导致未知的错误
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态