本文旨在记录如何通过rpm升级docker
环境
- centos7
- docker1.13.1(当前版本)
- docker-ce 19.03.13(目标版本)
当前版本卸载
- 确认当前版本的docker package:
[root@k8s2 ~]# rpm -qa | grep docker
docker-client-1.13.1-208.git7d71120.el7_9.x86_64
docker-common-1.13.1-208.git7d71120.el7_9.x86_64
docker-1.13.1-208.git7d71120.el7_9.x86_64
- 删除当前包
rpm -e docker-1.13.1-208.git7d71120.el7_9.x86_64
rpm -e docker-client-1.13.1-208.git7d71120.el7_9.x86_64
rpm -e docker-common-1.13.1-208.git7d71120.el7_9.x86_64
- 删除确认
rpm -qa | grep docker
- 此时应该没有内容表示
目标版本安装
- 下载目标版本rpm包
wget http://docker-release-purple-prod.s3-website-us-east-1.amazonaws.com/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.13-3.el7.x86_64.rpm
- 升级
rpm -Uvh docker-ce-19.03.13-3.el7.x86_64.rpm
-
安装与升级时有依赖链存在,如果依赖包不存在,会提示下载依赖包:
エラー: 依存性の欠如: containerd.io >= 1.2.2-3 は docker-ce-3:19.03.13-3.el7.x86_64 に必要とされています docker-ce-cli は docker-ce-3:19.03.13-3.el7.x86_64 に必要とされています
这里按要求下载安装containerd.io
和docker-ce-cli
。如果有其他依赖项,照如下操作做相同处理即可。
# containerd.io
wget http://docker-release-purple-prod.s3-website-us-east-1.amazonaws.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.2-3.el7.x86_64.rpm
rpm -Uvh containerd.io-1.2.2-3.el7.x86_64.rpm
# docker-ce-cli
wget http://docker-release-purple-prod.s3-website-us-east-1.amazonaws.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-19.03.13-3.el7.x86_64.rpm
rpm Uvh docker-ce-cli-19.03.13-3.el7.x86_64.rpm
- 安装完成确认
[root@k8s2 ~]# rpm -qa | grep docker
docker-ce-19.03.13-3.el7.x86_64
docker-ce-cli-19.03.13-3.el7.x86_64
[root@k8s2 ~]# docker -v
Docker version 19.03.13, build 4484c46d9d
启动docker service
systemctl daemon-reload
systemctl enable docker.service
systemctl start docker.service
systemctl status docker.service