很早之前,已經使用過了Docker了,可是沒有使用過 Docker 部署 NetCore 3.1 的應用程序,今天部署的時候發生了一些問題,解決辦法:Docker 版本過低了,那就升級一下。下面是具體的方法
一、查找主機上關於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
二、使用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不存在,刪除完成。
沒有該命令或者該目錄
三、使用curl升級到最新版
# curl -fsSL https://get.docker.com/ | sh
四、重啓Docker
# systemctl restart docker
五、設置Docker開機自啓
# systemctl enable docker
六、查看Docker版本信息
# docker version
linux
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 - Community 12 Engine: 13 Version: 19.03.13 14 API version: 1.40 (minimum version 1.12) 15 Go version: go1.13.15 16 Git commit: 4484c46d9d 17 Built: Wed Sep 16 17:02:21 2020 18 OS/Arch: linux/amd64 19 Experimental: false 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
七、查看Docker系統信息,包括鏡像和容器數…
# docker info
git
1 [root@localhost ~]# docker info 2 Client: 3 Debug Mode: false 4 5 Server: 6 Containers: 5 7 Running: 0 8 Paused: 0 9 Stopped: 5 10 Images: 3 11 Server Version: 19.03.13 12 Storage Driver: overlay2 13 Backing Filesystem: xfs 14 Supports d_type: true 15 Native Overlay Diff: true 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 22 Swarm: inactive 23 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: false 42 Registry: https://index.docker.io/v1/ 43 Labels: 44 Experimental: false 45 Insecure Registries: 46 127.0.0.0/8 47 Live Restore Enabled: false
八、使用docker images命令查看本身以前的鏡像是否存在redis
#docker images
docker
[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
升級完成,大功告成,繼續咱們的微服務。
json