默认storage driver与文件系统有关,centos7上,xfs默认为devicemapper, ext4默认为overlay2
10.110.154.48 18.06.1-ce overlay2 extfs 10.110.92.207 18.06.1-ce devicemapper xfs
参考: ref
Version 4.0 or higher of the Linux kernel, or RHEL or CentOS using version 3.10.0-514 of the kernel or higher. Docker EE users using kernels older than 4.0 need to follow some extra steps, outlined below. If you use an older kernel, you need to use the overlay driver, which is not recommended.
xfs (RHEL 7.2 and higher), but only with dtype=true
to verify that the enabled. Use
xfsinfoftype
option is set to 1
. To format an xfs filesystem correctly, use the flag -n ftype=1
.
Warning: Running on XFS without d_type support now causes Docker to skip the attempt to use the overlay or overlay2 driver. Existing installs will continue to run, but produce an error. This is to allow users to migrate their data. In a future version, this will be a fatal error, which will prevent Docker from starting.
应该是以上原因导致xfs没有用overlay2
# xfs_info /letv/ meta-data=/dev/sda6 isize=256 agcount=4, agsize=33592704 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0 spinodes=0 data = bsize=4096 blocks=134370816, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =internal bsize=4096 blocks=65610, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
由上文,centos7中默认用的是overlay2,不需要在/etc/docker/daemon.json
下配置,用了devicemapper
的原因是xfs文件系统ftype
选项不准确,因此添加docker info监控,遇到这样的情况,针对单台机器重新格式化比较好
function dockerinfo() { case "$1" in "storage") sudo docker info |grep "^Storage" 2>/dev/null |awk '{print $NF}';; "*") echo "error";; esac }
触发器表达式,str不要加引号
{Kubernetes:lld_asset[dockerstorage].str(overlay2)}=0
文档上说centos7用overlay2需要3.10.0-514
以上的内核,但是我线上3.10.0-327
的yum安装docker后默认就是overlay2,并且正常运行。
参考文档: