天天看點

docker 更新到最新版本

1 删除之前的版本

Docker 要求 CentOS 系統的核心版本高于 3.10 ,檢視CentOS的核心版本

[email protected] ~]# uname -a
Linux build -.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
           

剛好我這個核心在臨界點:微笑��

2.删除舊的版本的docker

3.安裝需要的軟體包, yum-util 提供yum-config-manager功能,另外兩個是devicemapper驅動依賴的

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

4.設定docker yum源

[[email protected] ~]# 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版本,并選擇特定版本安裝

[[email protected] ~]# 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            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-el7.centos             docker-ce-stable
docker-ce.x86_64            .ce-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
           ├─ /usr/bin/dockerd
           └─ docker-containerd --config /var/run/docker/containerd/containerd.toml

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

檢視version

[root@build ~]# docker version
Client:
 Version:   .0-ce
 API version:   
 Go version:    go1.9.4
 Git commit:    
 Built: Wed Mar  :9: 
 OS/Arch:   linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:  .0-ce
  API version:   (minimum version )
  Go version:   go1.9.4
  Git commit:   
  Built:    Wed Mar  ::3 
  OS/Arch:  linux/amd64
  Experimental: false
           

更新成功