加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

如何将Docker升级到最新版本

发布时间:2020-12-13 22:17:14 所属栏目:Linux 来源:网络整理
导读:很早以前,已经使用过了Docker了,但是没有使用过 Docker 部署 NetCore 3.1 的应用程序,今天部署的时候发生了一些问题,解决办法:Docker 版本太低了,那就升级一下。下面是具体的方法 1、查找主机上关于Docker的软件包 # rpm -qa | grep docker – – 列出

很早以前,已经使用过了Docker了,但是没有使用过 Docker 部署 NetCore 3.1 的应用程序,今天部署的时候发生了一些问题,解决办法:Docker 版本太低了,那就升级一下。下面是具体的方法

1、查找主机上关于Docker的软件包

  # rpm -qa | grep docker – – 列出包含docker字段的软件的信息

  docker-1.13.1-53.git774336d.el7.centos.x86_64
  docker-client-1.13.1-53.git774336d.el7.centos.x86_64
  docker-common-1.13.1-53.git774336d.el7.centos.x86_64

2、使用yum remove卸载软件

  # yum remove docker-1.13.1-53.git774336d.el7.centos.x86_64
  # yum remove docker-client-1.13.1-53.git774336d.el7.centos.x86_64
  # yum remove docker-common-1.13.1-53.git774336d.el7.centos.x86_64

  删除完毕,然后运行命令检查一下,在使用docker命令会提示docker不存在,删除完成。
  没有该命令或者该目录

3、使用curl升级到最新版

  # curl -fsSL https://get.docker.com/ | sh

4、重启Docker

  # systemctl restart docker

5、设置Docker开机自启

  # systemctl enable docker

6、查看Docker版本信息

  # docker version
  

 1 [root@localhost ~]# docker version
 2 Client: Docker Engine - Community
 3  Version:           19.03.13
 4  API version:       1.40
 5  Go version:        go1.13.15
 6  Git commit:        4484c46d9d
 7  Built:             Wed Sep 16 17:03:45 2020
 8  OS/Arch:           linux/amd64
 9  Experimental:      false
10 
11 Server: Docker Engine -12  Engine:
13   Version:          14   API version:      1.40 (minimum version 1.12)
15   Go version:       go1.16   Git commit:       4484c46d9d
17   Built:            Wed Sep 02:21 18   OS/Arch:          linux/19   Experimental:     20  containerd:
21   Version:          1.3.7
22   GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
23  runc:
24   Version:          1.0.0-rc10
25   GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
26  docker-init:
27   Version:          0.18.0
28   GitCommit:        fec3683

?


7、查看Docker系统信息,包括镜像和容器数…

  # docker info
  

]# docker info
 2 Client:
 3  Debug Mode:  4 
 5 Server:
 6  Containers: 5
 7   Running:  8   Paused:  9   Stopped: 10  Images: 3
11  Server Version:  Storage Driver: overlay2
13   Backing Filesystem: xfs
14   Supports d_type: true
15   Native Overlay Diff: 16  Logging Driver: json-file
17  Cgroup Driver: cgroupfs
18  Plugins:
19   Volume: local
20   Network: bridge host ipvlan macvlan null overlay
21   Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
24  Default Runtime: runc
25  Init Binary: docker-init
26  containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
27  runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
28  init version: fec3683
29  Security Options:
30   seccomp
31    Profile: default
32  Kernel Version: 3.10.0-1062.12.1.el7.x86_64
33  Operating System: CentOS Linux 7 (Core)
34  OSType: linux
35  Architecture: x86_64
36  CPUs: 4
37  Total Memory: 972.4MiB
38  Name: localhost.patrickliu
39  ID: MIHL:XZIG:MTEG:4IY2:LDBT:AUTN:RKGL:GBE3:G5VR:CLTX:IWMW:ISLH
40  Docker Root Dir: /var/lib/docker
41  Debug Mode: 42  Registry: https://index.docker.io/v1/
43  Labels:
44  Experimental: 45  Insecure Registries:
46   127.0.0.0/8
47  Live Restore Enabled: false

?


8、使用docker images命令查看自己之前的镜像是否存在

  #docker images
  

[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
redis               latest              f0453552d7f2        7 months ago        98.2MB
hello-world         latest              bf756fb1ae65        10 months ago       13.3kB
hello-world         <none>              fce289e99eb9        22 months ago       1.84kB

?

  升级完成,大功告成,继续我们的微服务。

  

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读