服务端: mkdir /nfsc chmod -R 777 /nfsc mkdir /root/nfs/config cd /root/nfs/config vim exports /nfsc 192.168.71.135(rw,sync,no_root_squash,no_all_squash) /nfsc 192.168.71.136(rw,sync,no_root_squash,no_all_squash)
docker run -itd -v /nfsc:/nfsc -v /etc/localtime:/etc/localtime -v /root/nfs/config/exports:/etc/exports --net=host --privileged --name nfsserver nfs:v1 /usr/sbin/init
进入容器启动服务 docker exec -it nfsserver /bin/bash systemctl start nfs-server
客户端: mkdir /nfsc chmod -R 777 /nfsc
docker run -itd -v /nfsc:/nfsc -v /etc/localtime:/etc/localtime --net=host --privileged --name nfsclient nfs:v1 /usr/sbin/init
进入容器启动服务 docker exec -it nfsclient /bin/bash systemctl enable rpcbind systemctl start rpcbind #192.168.71.134为主机IP mount -t nfs 192.168.71.134:/nfsc /nfsc
设置自启动 vi /etc/fstab 192.168.71.134:/nfsc /nfsc nfs defaults 0 0
自启动nfs systemctl restart rpcbind
Content type
Image
Digest
Size
117.8 MB
Last updated
about 7 years ago
docker pull yedonglin/nfs