Swarm集群使用共享volume
Swarm集群使用共享volume
- NFS服务端,配置nfs共享
yum install nfs-utils rpcbind -y mkdir -p /data/nfs/ echo "/data/nfs *(rw,no_root_squash,sync)" >> /etc/exports exportfs -r systemctl start rpcbind nfs-server systemctl enable rpcbind nfs-server showmount -e localhost #创建nfs docker共享volume [root@localhost ~]# docker volume create --driver local --opt o=addr=192.168.18.17,rw --opt device=:/data/nfs volume-nfs volume-nfs [root@localhost ~]# docker volume ls DRIVER VOLUME NAME local volume-nfs [root@localhost ~]# docker volume inspect volume-nfs [ { "Driver": "local", "Labels": {}, "Mountpoint": "/var/lib/docker/volumes/volume-nfs/_data", "Name": "volume-nfs", "Options": { "device": ":/data/nfs", "o": "addr=192.168.18.17,rw" }, "Scope": "local" } ]
- nfs客户端
yum install -y nfs-utils rpcbind #挂载nfs盘到相应的目录 mount -t nfs 192.168.18.17:/data/nfs/ /data/nfs #创建volume 连接 192.168.18.17:/data/nfs docker volume create --driver local \ --opt type=nfs \ --opt o=addr=192.168.18.17,rw \ --opt device=:/data/nfs \ volume-nfs #查看 docker volume ls docker volume inspect volume-nfs #容器使用volume-nfs docker run -dit --name busybox7 -v volume-nfs:/nfs busybox #查看 docker inspect -f {{.Mounts}} busybox7 df -h |grep /data/nfs #volume目录/var/lib/docker/volumes/volume-nfs/_data自动挂载到了nfs服务上
Swarm集群如果想要挂载nfs volume
#在管理节点上 docker service create --mount type=volume,src=volume-nfs,dst=/data/source/,volume-driver=local --name skplatform --hostname skplatform --network sk-net skplatform:dev
相关推荐
GQ00 2020-09-08
服务器开发的日子 2020-09-08
sapliang 2020-07-29
书弋江山 2020-07-08
Julyth 2020-06-14
changecan 2020-06-11
zccheu 2020-06-08
wykpaopao 2020-06-05
jingzhaopan 2020-06-04
饮马天涯 2020-05-20
kuberlin 2020-05-16
suosuo 2020-05-15
杜引强 2020-05-08
lenchio 2020-05-01
rareli 2020-02-16
htofly 2020-02-15
dayi 2020-01-18