这里使用
server1 2
yum install nfs-utils -y
保证打开服务rpcbind
mkdir /mnt/nfs
server1
vim /etc/exports
/mnt/nfs *(rw,no_root_squash) 或者改为777权限 chmod 777 /mnt/nfs
exportfs -rv
systemctl start nfs
showmount -e 172.25.11.1
server2
mkdir /mnt/nfs
mount 172.25.11.1:/mnt/nfs /mnt/nfs
server 1 2都做
需要插件 convoy.tar.gz
tar zxf convoy.tar.gz
cp convoy/convoy* /usr/local/bin/
cd /etc/docker
mkdir plugins
convoy daemon --drivers vfs --driver-opts vfs.path=/mnt/nfs &> /dev/null &
这样没有日志输出
cat /var/run/convoy/convoy.sock
/etc/docker/plugins/convoy.spec
spec是用来构建rpm包的文件
\vi convoy.spec 即可
echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec
创建卷
server1
convoy create vol1
convoy list
[root@server1 docker]# convoy list
{
"vol1": {
"Name": "vol1",
"Driver": "vfs",
"MountPoint": "",
"CreatedTime": "Sun Mar 17 14:04:25 +0800 2019",
"DriverInfo": {
"Driver": "vfs",
"MountPoint": "",
"Path": "/mnt/nfs/vol1",
"PrepareForVM": "false",
"Size": "0",
"VolumeCreatedAt": "Sun Mar 17 14:04:25 +0800 2019",
"VolumeName": "vol1"
},
"Snapshots": {}
}
}
server2
convoy list 会自动扫描到vol1
/mnt/nfs/vol1 为目录
[root@server2 docker]# convoy list
{
"vol1": {
"Name": "vol1",
"Driver": "vfs",
"MountPoint": "",
"CreatedTime": "Sun Mar 17 14:04:25 +0800 2019",
"DriverInfo": {
"Driver": "vfs",
"MountPoint": "",
"Path": "/mnt/nfs/vol1",
"PrepareForVM": "false",
"Size": "0",
"VolumeCreatedAt": "Sun Mar 17 14:04:25 +0800 2019",
"VolumeName": "vol1"
},
"Snapshots": {}
}
}
使用卷
server1
docker run -it --name vm1 -v vol1:/data ubuntu
[root@server1 docker]# touch /mnt/nfs/vol1/{1..3}
server2
ll /mnt/nfs/vol1
docker run -it --name vm1 -v vol1:/data ubuntu
root@ae95a48148cc:/data# ls
1 2 3
都是可以读写的共享
删除卷
docker rm vm1
convoy delete vol1
标签:convoy,管理,mnt,vol1,nfs,docker,vfs From: https://blog.51cto.com/u_15883840/5870329