升级docker1.12.6到18.09,并切换存储direct-lvm到overlay2
- 先确保操作系统内核为:3.10.0.862及其以上版本,可通过
uname -r
查看 - 停止并卸载docker
1
systemctl stop docker && yum remove -y docker*
- 删除docker存储,并删除docker目录
1
2
3vgremove docker #若这一步报devicebusy,则reboot节点之后重新vgremove。
pvremove /dev/***
rm -rf /var/lib/docker/* - 格式化overlay2存储
1
2mkfs.xfs -n ftype=1 /dev/***
mount /dev/*** /var/lib/docker - 加入开机启动/etc/fstab
1
/dev/*** /var/lib/docker xfs defaults 0 0
- 安装18.09.2的docker,并修改daemon.json配置文件
1
2
3
4
5yum install yum-utils -y
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum clean all
yum install docker-ce-18.09.5* -y
systemctl enable docker - 修改daemon.json配置文件,默认lvm的配置如下格式:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25[root@cloud-cn-master-1 ~]# cat /etc/docker/daemon.json
{
"insecure-registries": [
"192.168.0.4:60080",
"",
""
],
"storage-driver": "devicemapper",
"storage-opts": [
"dm.thinpooldev=/dev/mapper/docker-thinpool",
"dm.min_free_space=0%",
"dm.use_deferred_deletion=true",
"dm.use_deferred_removal=true",
"dm.fs=ext4"
]
}
修改后如下所示:
{
"insecure-registries": [
"192.168.0.4:60080",
"10.0.0.1:5000"
],
"storage-driver": "overlay2"
} - 启动docker
1
2systemctl start docker
systemctl enable docker
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.