本文的目的是说明,如何在生产环境中选择Docker 的storage driver。以及对应Linux发行版本下Docker storage driver的配置方法。主要参考,docker docs中对于storage driver中的介绍及docker商用版本兼容性矩阵中linux发行版本对于存储驱动的说明。 当前docker支持的storage driver包括:aufs,brtfs,devicemap,OverlayFs,ZFS 5种存储驱动。参考: https://docs.docker.com/engine/userguide/storagedriver/和 https://success.docker.com/Get_Help/Compatibility_Matrix_and_Maintenance_Lifecycle种的说明,当前生产环境中建议如下: rhel,centos,fedora:devicemapper direct-lvm ubuntu:aufs suse:brtfs 当前,生产环境中不建议使用zfs及overlayfs。由于公司产品使用的是centos 7,因此本文介绍下cenos7中如何配置docker使用devicemapper direct-lvm。停止docker daemonsystemctl stop docker11删除/var/lib/docker,rm -rf /var/lib/docker11利用pvcreate命令在空闲块上创建物理卷pvcreate /dev/sdx11利用上一步中创建的pv创建卷组vgcreate vg-docker /dev/sdx11分别创建data,metadata逻辑卷组lvcreate -L 90G -n data vg-dockerlvcreate -L 10G -n metadata vg-docker1212docker daemon参数配置--storage-driver=devicemapper --storage-opt dm.datadev=/dev/vg-docker/data --storage-opt dm.metadatadev=/dev/vg-docker/metadata11上述配置完成后,重启docker daemon即可完成配置。下面是配置完成后docker info查询的消息。[root@net1 docker]# docker infoContainers: 100 Running: 0 Paused: 0 Stopped: 100Images: 2Server Version: 1.10.3Storage Driver: devicemapper Pool Name: docker-253:0-469034-pool Pool Blocksize: 65.54 kB Base Device Size: 10.74 GB Backing Filesystem: xfs Data file: /dev/vg-docker/data Metadata file: /dev/vg-docker/metadata Data Space Used: 799.4 MB Data Space Total: 10.74 GB Data Space Available: 9.938 GB Metadata Space Used: 1.729 MB Metadata Space Total: 10.63 GB Metadata Space Available: 10.63 GB Udev Sync Supported: true Deferred Removal Enabled: false Deferred Deletion Enabled: false Deferred Deleted Device Count: 0 Library Version: 1.02.107-RHEL7 (2015-12-01)Execution Driver: native-0.2Logging Driver: json-filePlugins: Volume: local Network: null host overlay bridgeKernel Version: 3.10.0-229.el7.x86_64Operating System: CentOS Linux 7 (Core)OSType: linuxArchitecture: x86_64CPUs: 1Total Memory: 993.6 MiBName: net1ID: TU6M:E6WM:PZDN:ULJX:EWKS:UPLQ:Z54D:XP52:64C7:Z4XN:TJ76:VG7OWARNING: bridge-nf-call-ip6tables is disabledCluster store: etcd://172.28.0.2:4001Cluster advertise: 172.28.0.3:012345678910111213141516171819202122232425262728293031323334353637383940411234567891011121314151617181920212223242526272829303132333435363738394041总结 参考docker的介绍,centos7推荐使用devicemapper。同时,从docker官方文档的介绍可以看到无论使用哪种storage driver均推荐挂载数据卷。后续,会继续分析docker 当前多余数据卷的管理方法。
http://blog.csdn.net/asd05txffh/article/details/51134995