欲忘树 发表于 2019-2-22 08:22:45

CentOS7.x系统中使用Docker时,在存储方面需要注意的问题

  

  简述:
  1、Docker 1.12.6/v17.03文档中CentOS7系统下安装时,明确说明,用于生产时,必须使用devicemapper驱动的direct-lvm模式,需要我们提前准备好块设备,以提供更好的稳定性和性能。默认使用devicemapper驱动的loop-lvm模式,因为安装简单,只适用于测试环境。从docker info 信息可以看出,loop-lvm模式最大可用空间只有107GB。生产环境下必须使用devicemapper驱动的direct-lvm模式,使用块设备,速度更快并且能更有效地使用系统资源。
  2、在Docker v17.06及以后的版本中,关于OverlayFS存储驱动,尽量使用overlay2而不要使用overlay,官方的说明是overlay可以使用但不建议。使用overlay2时Linux系统内核要求4.0以上,或者CentOS7的内核在3.10.0-693以上。Docker-ce v17.06及以上,在使用overlay2驱动时,还需要设置额外的参数,以禁止检测内核为4.0版本。
  

  官网截图:
  01-Docker v17.03文档中CentOS7系统下安装时,明确说明,用于生产时,必须使用devicemapper驱动的direct-lvm模式,需要我们提前准备好块设备,以提供更好的稳定性和性能
  https://s1.运维网.com/images/blog/201803/24/7e0f6b5584eaf3c7569973c70014d82f.jpg
  02-Docker v17.03文档中CentOS7系统下安装时,默认使用devicemapper驱动的loop-lvm模式,因为安装简单,只适用于测试环境
  https://s1.运维网.com/images/blog/201803/24/77ae847ab854e1d71e142caf3108b4dc.jpg
  03-Docker v17.03文档中CentOS7系统下安装时,默认使用devicemapper驱动的loop-lvm模式,docker info 信息显示,最大可用空间只有107GB
  https://s1.运维网.com/images/blog/201803/24/d1edec9b25e8ff0fe890bb9bc43e9b2b.jpg
  

  04-生产环境下必须使用devicemapper驱动的direct-lvm模式,使用块设备,速度更快并且能更有效地使用系统资源
  https://s1.运维网.com/images/blog/201803/24/90c0a3cf8b917755894f1fefe1e00bcd.jpg
  

  05-关于OverlayFS存储驱动,尽量使用overlay2而不要使用overlay,使用overlay2时Linux系统内核要求4.0以上
  https://s1.运维网.com/images/blog/201803/24/58aff34251fe938075c987d8783e84c6.jpg
  

  06-新版本的Docker存储驱动说明,overlay可以使用但不建议,最好使用overlay2,内核需要4.0以上,或者CentOS7的内核在3.10.0-693以上,需要额外的设置参数。
  https://s1.运维网.com/images/blog/201803/24/43ca888deb733bcce1fb11507d1a4ea5.jpg
  

  07-CentOS7的用户,内核在3.10.0-693以上,Docker-ce v17.06及以上,在使用overlay2驱动时,还需要设置额外的参数,禁止检测内核为4.0版本。
  https://s1.运维网.com/images/blog/201803/24/ee27d8886b857089e00d5c6c3e94aee2.jpg
  

  参考链接:
  CentOS7下安装Docker v17.03
  https://docs.docker.com/v17.03/engine/installation/linux/centos/#install-from-a-package
  Use the Device Mapper storage driver
  https://docs.docker.com/v17.03/engine/userguide/storagedriver/device-mapper-driver/
  Use the OverlayFS storage driver
  https://docs.docker.com/v17.03/engine/userguide/storagedriver/overlayfs-driver/
  CentOS下修改Devicemapper存储驱动为Direct-lvm模式
  https://forums.cnrancher.com/article/19
  Use the Device Mapper storage driver
  https://docs.docker.com/storage/storagedriver/device-mapper-driver/
  CentOS下 Docker的安装
  https://docs.docker.com/v17.03/engine/installation/linux/centos/#install-from-a-package
  Configure direct-lvm mode for production
  https://docs.docker.com/v17.03/engine/userguide/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production
  Docker问答录(100)
  https://blog.lab99.org/post/docker-2016-07-14-faq.html#docker-de-var-lib-docker-devicemapper-zhan-yong-kong-jian-bu-duan-zeng-chang-zen-me-po
  Redhat7.2_release_notes (OverlayFS)
  https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.2_release_notes/technology-preview-file_systems
  Redhat7.3_release_notes (OverlayFS)
  https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.3_release_notes/technology_previews_file_systems
  Redhat7.4_release_notes (OverlayFS)
  https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.4_release_notes/technology_previews_file_systems



页: [1]
查看完整版本: CentOS7.x系统中使用Docker时,在存储方面需要注意的问题