为什么需要
Docker管理应用,应用要存数据;根据应用的需要,数据空间有可能需要在多个HOST之间被共享,有可能需要支持多种后端存储(Ceph/GlusterFS/EBS/…),还有可能需要对数据空间本身做管理(snapshot/backup/clone…);
上面是应用的需要,再回过头来看看Docker对存储的使用,一个字:mount;
为了把这两头凑起来,简单分类有这样几种方法:
I 编排系统管理存储,将已经规划好的存储空间交给Docker,Docker只管mount就好
II 编排系统只下发存储使用需求,由Docker自己管理存储系统,自己创建卷/mkfs/mount;Docker Volume Plugins属于这种
III 存储作为一种应用服务,应用自己去联系
现在有哪些
Plugin |
Description |
|
Lets you mount Microsoft Azure File Storage shares to Docker containers as volumes using the SMB 3.0 protocol. Learn more. |
|
A volume plugin that provides access to an extensible set of container-based persistent storage options. It supports single and multi-host Docker environments with features that include tenant isolation, automated provisioning, encryption, secure deletion, snapshots and QoS. |
|
An open source volume plugin that provides multi-tenant, persistent, distributed storage with intent based consumption using ceph underneath. |
|
A volume plugin for a variety of storage back-ends including device mapper and NFS. It's a simple standalone executable written in Go and provides the framework to support vendor-specific extensions such as snapshots, backups and restore. |
|
A volume plugin that provides highly available storage replicated by . Data written to the docker volume is replicated in a cluster of DRBD nodes. |
|
A volume plugin that provides multi-host portable volumes for Docker, enabling you to run databases and other stateful containers and move them around across a cluster of machines. |
A volume plugin able to attach, format and mount Google Compute . |
|
|
A volume plugin that provides multi-host volumes management for Docker using GlusterFS. |
|
A volume plugin that allows on-demand, version controlled access to your data. Horcrux is an open-source plugin, written in Go, and supports SCP, and Amazon S3. |
|
An open source volume plugin that allows using an filesystem as a volume. |
|
A plugin that provides credentials and secret management using Keywhiz as a central repository. |
|
A volume plugin that extends the default local driver's functionality by allowing you specify a mountpoint anywhere on the host, which enables the files to always persist, even if the volume is removed via docker volume rm. |
(nDVP) |
A volume plugin that provides direct integration with the Docker ecosystem for the NetApp storage portfolio. The nDVP package supports the provisioning and management of storage resources from the storage platform to Docker hosts, with a robust framework for adding additional platforms in the future. |
|
A volume plugin that provides volume management for NFS 3/4, AWS EFS and CIFS file systems. |
|
A cluster-aware volume plugin that provides volume management for file and block storage solutions. It implements a vendor neutral specification for implementing extensions such as CoS, encryption, and snapshots. It has example drivers based on FUSE, NFS, NBD and EBS to name a few. |
|
A volume plugin that connects Docker to 's data center file system, a general-purpose scalable and fault-tolerant storage platform. |
|
A volume plugin which is written in Go and provides advanced storage functionality for many platforms including VirtualBox, EC2, Google Compute Engine, OpenStack, and EMC. |
|
A volume plugin with support for Virtuozzo Storage distributed cloud file system as well as ploop devices. |
|
Docker Volume Driver for vSphere enables customers to address persistent storage requirements for Docker containers in vSphere environments. |
试用一下
glusterfs
安装
yum install go
mkdir –p /home/gopath
mkdir –p /home/gopath/src
mkdir –p /home/gopath/bin
mkdir –p /home/gopath/pkg
GOPATH=/home/gopath
export GOPATH
go get github.com/calavera/docker-volume-glusterfs
使用
#启动plugin
./docker-volume-glusterfs --servers=172.16.74.24:172.16.74.25
#使用glusterfs的test-vol作为数据盘
docker run -it --volume-driver glusterfs -v test-vol:/datas/ ubuntu /bin/bash
Trouble shootting
package golang.org/x/net/proxy: unrecognized import path "golang.org/x/net/proxy"
mkdir -p /home/gopath/src/golang.org/x
cd /home/gopath/src/golang.org/x
git clone
convoy
安装
wget
tar xvf convoy.tar.gz
cp convoy/convoy convoy/convoy-pdata_tools /usr/local/bin/
mkdir -p /etc/docker/plugins/
bash -c 'echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec'
#测试环境,构建loop块设备,为后面的devicemapper-thin-pool使用
truncate -s 100G data.vol
truncate -s 1G metadata.vol
losetup /dev/loop5 data.vol
losetup /dev/loop6 metadata.vol
使用
convoy daemon --drivers devicemapper --driver-opts dm.datadev=/dev/loop5 --driver-opts dm.metadatadev=/dev/loop6
docker run -v vol-1/data --volume-driver=convoy -it magnum /bin/bash
支持snapshot/backup
其他
convoy目前支持devicemapper、vfs和ebs(s3)
demo:
自己开发一个?
感觉怎么样
第一, 试用的两个plugin可以工作,但离成熟还有段距离,比如convoy,可能和两年前的cinder差不多
第二, 有段时间觉得 OpenStack越来越臃肿,Docker和其生态给人扑面而来的小清新;现在想来,可能是因为它还处于发展初期,管的还比较单纯,就像一个少女,柴米油盐没有写在脸上
第三, 个人审美角度,我希望Docker,只把应用打包/部署这一件事做好,把网络和存储的问题交给上层框架去协调;但是现在,Docker本身开始涉足网络、存储,就像少女长大了,要浓妆艳抹。不知道后面会怎样,我们拭目以待吧。