Docker 安装指定版本

需求

安装指定的Docker版本:17.03.1

准备工作

[root@s2 docker]# ls -la
total 8128
drwxr-xr-x. 2 root root     180 May  2 08:31 .
drwxr-xr-x. 3 root root      20 Apr 20 10:58 ..
-rw-r--r--  1 root root 2705534 May  2 08:19 docker-ce-17.03.1.ce-1.el7.centos.x86_64.rpm
-rw-r--r--  1 root root 5579832 May  2 08:31 docker-ce-debuginfo-17.03.1.ce-1.el7.centos.x86_64.rpm
-rw-r--r--  1 root root   29108 Feb 13 19:33 docker-ce-selinux-17.03.1.ce-1.el7.centos.noarch.rpm

卸载与安装

卸载原有的版本
yum remove -y docker* container-selinux

安装rpm包
yum localinstall -y *.rpm

排错流程

  1. 首先运行 docker 发现不可以

  2. 查询 *.rpm 是否已经安装

[root@s2 docker]#  yum list installed | grep docker
docker-ce-debuginfo.x86_64           17.03.1.ce-1.el7.centos        @/docker-ce-debuginfo-17.03.1.ce-1.el7.centos.x86_64
docker-ce-selinux.noarch             17.03.1.ce-1.el7.centos        @/docker-ce-selinux-17.03.1.ce-1.el7.centos.noarch
  1. 从 2 可以发现缺少了主要的docker安装包 docker-ce.x86_64,然后单独运行
[root@s2 docker]# yum localinstall -y docker-ce-17.03.1.ce-1.el7.centos.x86_64.rpm           
Loaded plugins: fastestmirror
Examining docker-ce-17.03.1.ce-1.el7.centos.x86_64.rpm: docker-ce-17.03.1.ce-1.el7.centos.x86_64
Marking docker-ce-17.03.1.ce-1.el7.centos.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:17.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: docker-ce-selinux >= 17.03.1.ce-1.el7.centos for package: docker-ce-17.03.1.ce-1.el7.centos.x86_64
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
--> Finished Dependency Resolution
Error: Package: docker-ce-17.03.1.ce-1.el7.centos.x86_64 (/docker-ce-17.03.1.ce-1.el7.centos.x86_64)
           Requires: docker-ce-selinux >= 17.03.1.ce-1.el7.centos
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
  1. 从 3 可以看出安装的时候已经报Error
    在网上很多类似的问题,都指向 daemon.json 文件错误,但是这里压根没有 daemon.json 文件,直接跳过,也有说是之前安装过新的版本,现在安装旧版本导致,需要忽略obsoletes即可,其实我发现还有一个情况。就是安装的顺序
yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.1.ce-1.el7.centos.noarch.rpm 

yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.1.ce-1.el7.centos.x86_64.rpm

快捷安装

[eddie@localhost /]# yum -y update
[eddie@localhost /]# yum install -y docker

Created by Eddie.Lee

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

eddie_k2

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值