服务器平台:
VMware® Workstation 15 Pro(15.5.2 build-15785246)
CentOS7(3.10.0-957.el7.x86_64)
1.查找已安装的 Docker 软件包
rpm -qa | grep docker
---------------------------------------------------------------
[root@localhost ~]# rpm -qa | grep docker
docker-ce-18.06.1.ce-3.el7.x86_64
2.卸载相应的软件
yum remove xxx
---------------------------------------------------------------
[root@localhost ~]# yum remove docker-ce-18.06.1.ce-3.el7.x86_64
Loaded plugins: fastestmirror, langpacks, versionlock
Resolving Dependencies
--> Running transaction check
......
删除完成,运行第一条命令进行确认。
3.升级到最新版本
curl -fsSL https://get.docker.com/|sh
---------------------------------------------------------------
[root@localhost ~]# curl -fsSL https://get.docker.com/|sh
# Executing docker install script, commit: 3d8fe77c2c46c5b7571f94b42793905e5b3e42e4
+ sh -c 'yum install -y -q yum-utils'
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror, langpacks, versionlock
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
Loaded plugins: fastestmirror, langpacks, versionlock
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 6.3 kB 00:00:00
* base: mirrors.aliyun.com
* epel: mirrors.bfsu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/6): epel/x86_64/prestodelta
......
4.重启 Docker
systemctl restart docker
5.设置开机启动
systemctl enable docker
6.查看 Docker 版本信息
docker version # 不需要启动 docker
docker --version # 必须启动 docker
---------------------------------------------------------------
[root@localhost ~]# docker --version
Docker version 20.10.1, build 831ebea
7.查看之前的镜像
docker images
---------------------------------------------------------------
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mongo latest 3068f6bb852e 12 days ago 493MB
rabbitmq 3-management 41f7a13e37d3 13 days ago 186MB
10.10.0.238:85/tensquare/tensquare_eureka_server latest bd5cf2311b90 8 weeks ago 150MB
10.10.0.238:85/tensquare/tensquare_gathering latest 80bc06543a86 2 months ago 156MB
10.10.0.238:85/tensquare/tensquare_admin_service latest 39cc8c116eb7 2 months ago 158MB
10.10.0.238:85/tensquare/tensquare_zuul latest b7752bde550a 2 months ago 147MB
eureka v1 3205689e8553 2 months ago 150MB
10.10.0.238:85/tensquare/eureka v2 aa950e6e0916 2 months ago 150MB
goharbor/chartmuseum-photon v0.9.0-v1.9.2 06f0bb43a123
......
Congratulation,升级成功。