docker 升级到最新版本

1 删除之前的版本

Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看CentOS的内核版本

root@build ~]# uname -a
Linux build 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

刚好我这个内核在临界点:微笑��

2.删除旧的版本的docker

sudo yum remove docker  docker-common docker-selinux docker-engine

3.安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

4.设置docker yum源

[root@build ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
已加载插件:fastestmirror
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

5.可以查看所有仓库中所有docker版本,并选择特定版本安装

[root@build ~]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror
可安装的软件包
 * updates: mirror.hostduplex.com
Loading mirror speeds from cached hostfile
 * extras: mirrors.ocf.berkeley.edu
 * epel: mirror.hmc.edu
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable
 * base: mirror.scalabledns.com

6.安装docker

sudo yum install docker-ce  #由于repo中默认只开启stable仓库,故这里安装的是最新稳18.03.0.ce-1.el7.centos
$ sudo yum install <FQPN>  #安装指定的版本 例如:sudo yum install docker-ce.x86_64.0.18.03.0.ce-1.el7.centos

启动

[root@build ~]# systemctl start docker
[root@build ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since 五 2018-04-06 13:00:45 CST; 6s ago
     Docs: https://docs.docker.com
 Main PID: 1860 (dockerd)
    Tasks: 16
   Memory: 36.8M
   CGroup: /system.slice/docker.service
           ├─1860 /usr/bin/dockerd
           └─1864 docker-containerd --config /var/run/docker/containerd/containerd.toml

406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45+08:00" level=info msg="containerd successfully booted in 0.010404s" module=containerd
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.261882893+08:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.268484303+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.269312299+08:00" level=info msg="Loading containers: start."
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.765534367+08:00" level=info msg="Default bridge (docker0) is assigned with an IP a... address"
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.963031445+08:00" level=info msg="Loading containers: done."
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.972614264+08:00" level=info msg="Docker daemon" commit=0520e24 graphdriver(s)=over...8.03.0-ce
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.972688448+08:00" level=info msg="Daemon has completed initialization"
406 13:00:45 build dockerd[1860]: time="2018-04-06T13:00:45.989279083+08:00" level=info msg="API listen on /var/run/docker.sock"
406 13:00:45 build systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.

查看version

[root@build ~]# docker version
Client:
 Version:   18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24
 Built: Wed Mar 21 23:09:15 2018
 OS/Arch:   linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:  18.03.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   0520e24
  Built:    Wed Mar 21 23:13:03 2018
  OS/Arch:  linux/amd64
  Experimental: false

更新成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值