由於Docker的鏡像是分層的,包含只讀層和可讀寫層,所以選擇正確的Storage Driver對於容器的性能是很是重要的。node
目前推薦使用性能最好的Overlay2。RHEL或CentOS須要要求Linux Kernel在4.0或以上,或者使用3.10.0-514以上版本。docker
查看Docker目前使用的Storage Driverjson
[root@node01 ~]# docker info Containers: 25 Running: 21 Paused: 0 Stopped: 4 Images: 19 Server Version: 18.06.3-ce Storage Driver: overlay2 Backing Filesystem: xfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: systemd
修改Docker的Storage Drivervim
[root@node01 ~]# vim /etc/docker/daemon.json { "exec-opts": ["native.cgroupdriver=systemd"], "registry-mirrors": ["https://fz5yth0r.mirror.aliyuncs.com"], "storage-driver": "overlay2",
"log-driver": "json-file", "log-opts": { "max-size": "100m", "max-file": "3" } } ~