导读 本文档介绍检查Docker版本,重装Docker,给有需要有朋友提供参考。
检查 Docker 版本
[root@Docker ]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:25:42 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
查看所有仓库中所有docker版本,并选择特定的版本安装
[root@Docker ]# yum list docker-ce --showduplicates | sort -r
 * updates: mirrors.aliyun.com
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
 * extras: mirrors.ustc.edu.cn
 * epel: hkg.mirror.rackspace.com
docker-ce.x86_64            3:19.03.8-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.7-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.6-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.5-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.4-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.3-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.0-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.9-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.8-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.7-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.6-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.5-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.4-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.3-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64            18.06.3.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.2.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
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.3.ce-1.el7                    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: mirrors.aliyun.com
Available Packages
重装 Docker
安装 docker-ce-18.06.0.ce
[root@Docker ]# yum remove docker  docker-common docker-selinux docker-engine -y
[root@Docker ]# yum install -y docker-ce-18.06.0.ce
可能会遇到的报错
 file /usr/share/zsh/vendor-completions/_docker from install of docker-ce-18.06.0.ce-3.el7.x86_64 conflicts with file from package docker-ce-cli-1:19.03.8-3.el7.x86_64

Error Summary
解决方法

卸载 docker-ce-cli-1:19.03.8-3.el7.x86_64 -y

[root@Docker ]# yum erase docker-ce-cli-1:19.03.8-3.el7.x86_64 -y

再次安装 docker-ce-18.06.0.ce

[root@Docker ]# yum install -y docker-ce-18.06.0.ce
[root@Docker ]# systemctl start docker
[root@Docker ]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@Docker ]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─kolla.conf
   Active: active (running) since Mon 2020-03-30 14:25:00 EDT; 24s ago
     Docs: //docs.docker.com
 Main PID: 21775 (dockerd)
   CGroup: /system.slice/docker.service
           ├─21775 /usr/bin/dockerd
           └─21782 docker-containerd --config /var/run/docker/containe...

Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack dockerd[21775 ]: time="2020-0...
Mar 30 14:25:00 openstack systemd[1 ]: Started Docker A...
Hint: Some lines were ellipsized, use -l to show in full.

查看 Docker 版本信息

[root@Docker ~]# docker --version
Docker version 18.06.0-ce, build 0ffa825
[root@Docker ~]# docker version   
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:08:18 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:10:42 2018
  OS/Arch:          linux/amd64
  Experimental:     false
总结

至此,docker-ce-18.06.0.ce 安装成功!想看 Docker 后续操作的朋友,请持续关注我的文章,希望我的文章能给大家带来帮助。

本文原创地址://q13zd.cn/docker-reinstall-docker.html编辑:public,审核员:逄增宝