2

我之前在我的 CentOS 8 中安装了 docker,现在我正在尝试更新。

这个答案中描述了我的更新步骤https://stackoverflow.com/a/67942165/1410223

sudo rpm -Uvh https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.6-3.1.el8.x86_64.rpm
sudo rpm -Uvh https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-cli-20.10.7-3.el8.x86_64.rpm
sudo rpm -Uvh https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.7-3.el8.x86_64.rpm

但是检查我的版本...

$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:42:53 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:48 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
$

或者

$ docker -v
Docker version 19.03.12, build 48a66213fe
$ 

如何更新客户端?

我在检查

$ sudo yum list docker-ce-cli --showduplicates | sort -r
Last metadata expiration check: 2:01:33 ago on Sun 13 Jun 2021 12:10:18 PM -05.
Installed Packages
docker-ce-cli.x86_64              1:20.10.7-3.el8               @System         
docker-ce-cli.x86_64              1:20.10.7-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.6-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.5-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.4-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.3-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.2-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.1-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:20.10.0-3.el8               docker-ce-stable
docker-ce-cli.x86_64              1:19.03.15-3.el8              docker-ce-stable
docker-ce-cli.x86_64              1:19.03.14-3.el8              docker-ce-stable
docker-ce-cli.x86_64              1:19.03.13-3.el8              docker-ce-stable
Available Packages
$

对待一些不必要的东西。

$ sudo yum erase docker-ce-cli-19.03.12-3.el8
No match for argument: docker-ce-cli-19.03.12-3.el8
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!
$

检查包裹

$ sudo yum list installed | grep docker
docker-ce.x86_64                                   3:20.10.7-3.el8                               @System                   
docker-ce-cli.x86_64                               1:20.10.7-3.el8                               @System                   
docker-ce-rootless-extras.x86_64                   20.10.7-3.el8                                 @System                   
docker-scan-plugin.x86_64                          0.8.0-3.el8                                   @System                   
$

我的步骤

$ rpm -qa | grep containerd
containerd.io-1.4.6-3.1.el8.x86_64
$

我尝试卸载

$ rpm -evh containerd
error: package containerd is not installed
$

让我们再试一次

$ rpm -evh containerd.io-1.4.6-3.1.el8.x86_64
error: Failed dependencies:
    containerd.io >= 1.4.1 is needed by (installed) docker-ce-3:20.10.7-3.el8.x86_64
$

让我们检查一下docker-ce

$ rpm -qa | grep docker-ce
docker-ce-cli-20.10.7-3.el8.x86_64
docker-ce-rootless-extras-20.10.7-3.el8.x86_64
docker-ce-20.10.7-3.el8.x86_64
$

去删除它

$ rpm -evh docker-ce-20.10.7-3.el8.x86_64
error: Failed dependencies:
    docker-ce is needed by (installed) docker-ce-rootless-extras-0:20.10.7-3.el8.x86_64
$

然后

$ rpm -evh docker-ce-rootless-extras-0:20.10.7-3.el8.x86_64
error: Failed dependencies:
    docker-ce-rootless-extras is needed by (installed) docker-ce-3:20.10.7-3.el8.x86_64
$

再次尝试同时删除:docker-cedocker-ce-rootless-extras!

$ sudo rpm -evh docker-ce-20.10.7-3.el8.x86_64 docker-ce-rootless-extras-0:20.10.7-3.el8.x86_64
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:docker-ce-3:20.10.7-3.el8        ################################# [ 50%]
   2:docker-ce-rootless-extras-0:20.10################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.7.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
$

我去删除docker-ce-cli

$ rpm -evh docker-ce-cli-20.10.7-3.el8.x86_64
error: Failed dependencies:
    docker-ce-cli is needed by (installed) docker-scan-plugin-0:0.8.0-3.el7.x86_64
$

让我们同时删除:docker-ce-clidocker-scan-plugin.

$ sudo rpm -evh docker-ce-cli-20.10.7-3.el8.x86_64 docker-scan-plugin-0:0.8.0-3.el7.x86_64
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:docker-ce-cli-1:20.10.7-3.el8    ################################# [ 50%]
   2:docker-scan-plugin-0:0.8.0-3.el7 ################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.7.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
$

现在安装docker-ce-clidocker-scan-plugin

$ sudo rpm -Uvh https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-cli-20.10.7-3.el8.x86_64.rpm https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-scan-plugin-0.8.0-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-cli-20.10.7-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-scan-plugin-0.8.0-3.el8.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:docker-scan-plugin-0:0.8.0-3.el8 ################################# [ 50%]
   2:docker-ce-cli-1:20.10.7-3.el8    ################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.7.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
$

现在我将安装docker-cedocker-ce-rootless-extras

$ sudo rpm -Uvh https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.7-3.el8.x86_64.rpm https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.7-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:docker-ce-rootless-extras-0:20.10################################# [ 50%]
   2:docker-ce-3:20.10.7-3.el8        ################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.7.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
$ 

我会查的

$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:42:53 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$ docker -v
Docker version 19.03.12, build 48a66213fe
$

我将删除所有:

$ sudo rpm -evh docker-ce-20.10.7-3.el8.x86_64 docker-ce-rootless-extras-0:20.10.7-3.el8.x86_64 docker-ce-cli-20.10.7-3.el8.x86_64 docker-scan-plugin-0.8.0-3.el8.x86_64 containerd.io-1.4.6-3.1.el8.x86_64
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:docker-ce-3:20.10.7-3.el8        ################################# [ 20%]
   2:docker-ce-cli-1:20.10.7-3.el8    ################################# [ 40%]
   3:docker-scan-plugin-0:0.8.0-3.el8 ################################# [ 60%]
   4:containerd.io-1.4.6-3.1.el8      ################################# [ 80%]
   5:docker-ce-rootless-extras-0:20.10################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.7.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
$

我会尝试安装所有

$ sudo rpm -Uvh \
> https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.6-3.1.el8.x86_64.rpm \
> https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.7-3.el8.x86_64.rpm \
> https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm \
> https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-cli-20.10.7-3.el8.x86_64.rpm \
> https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-scan-plugin-0.8.0-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.6-3.1.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.7-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-cli-20.10.7-3.el8.x86_64.rpm
Retrieving https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-scan-plugin-0.8.0-3.el8.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:docker-scan-plugin-0:0.8.0-3.el8 ################################# [ 20%]
   2:docker-ce-cli-1:20.10.7-3.el8    ################################# [ 40%]
   3:containerd.io-1.4.6-3.1.el8      ################################# [ 60%]
   4:docker-ce-rootless-extras-0:20.10################################# [ 80%]
   5:docker-ce-3:20.10.7-3.el8        ################################# [100%]
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.12.10-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.7.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
/sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.8.0-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored
$

我再次检查版本...

$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:42:53 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$

启动泊坞窗

$ sudo systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
$

我会检查状态。

$ systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2021-06-13 13:29:10 -05; 21s ago
     Docs: https://docs.docker.com
  Process: 29333 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 29333 (code=exited, status=1/FAILURE)

Jun 13 13:29:10 centos.bz systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
Jun 13 13:29:10 centos.bz systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Jun 13 13:29:10 centos.bz systemd[1]: Stopped Docker Application Container Engine.
Jun 13 13:29:10 centos.bz systemd[1]: docker.service: Start request repeated too quickly.
Jun 13 13:29:10 centos.bz systemd[1]: docker.service: Failed with result 'exit-code'.
Jun 13 13:29:10 centos.bz systemd[1]: Failed to start Docker Application Container Engine.
$

尝试重新开始!

$ sudo systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
$ 

检查调试

$ sudo dockerd --debug

我可以看到这些行:

WARN[2021-06-13T13:31:13.094390554-05:00] Your kernel does not support cgroup blkio weight 
WARN[2021-06-13T13:31:13.094408768-05:00] Your kernel does not support cgroup blkio weight_device 

我重新启动:

$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:42:53 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:48 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
$ 

不幸的是我有相同版本的客户端!

4

1 回答 1

1

使用搜索工具检查内部文件并查找哪些文件具有19.03.12要卸载的 docker 版本。

发现许多文件内容为“ 19.03.12”,但最可疑的是$HOME/bin目录:

  • docker
  • dockerd

我在上面找到了一些文件

$ ls ~/bin
containerd  containerd-shim  ctr  docker  dockerd  dockerd-rootless.sh  docker-init  docker-proxy  rootlesskit  rootlesskit-docker-proxy  runc  vpnkit
$

Maybe just deleting or renaming those files would have been enough (without having to uninstall or reinstall everything), but I didn't test at the time.

  1. 我再次全部卸载

    $ sudo rpm -evh \
    containerd.io-1.4.6-3.1.el8.x86_64 \
    docker-ce-20.10.7-3.el8.x86_64 \
    docker-ce-rootless-extras-0:20.10.7-3.el8.x86_64 \
    docker-ce-cli-20.10.7-3.el8.x86_64 \
    docker-scan-plugin-0.8.0-3.el8.x86_64
    
  2. 我重命名了可疑文件(我重命名了几乎所有文件,尽管有些可能是不必要的)。

    $ ls $HOME/bin
    containerd_OLD  containerd-shim_OLD  ctr  dockerd_OLD  dockerd-rootless.sh_OLD  docker-init_OLD  docker_OLD  docker-proxy_OLD  rootlesskit-docker-proxy_OLD  rootlesskit_OLD  runc_OLD  vpnkit
    $ 
    
  3. 重新安装所有

    $ sudo rpm -Uvh \
    https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.6-3.1.el8.x86_64.rpm \
    https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-20.10.7-3.el8.x86_64.rpm \
    https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-rootless-extras-20.10.7-3.el8.x86_64.rpm \
    https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-ce-cli-20.10.7-3.el8.x86_64.rpm \
    https://download.docker.com/linux/centos/8/x86_64/stable/Packages/docker-scan-plugin-0.8.0-3.el8.x86_64.rpm
    
  4. 我重新启动了我的机器。

  5. 启用泊坞窗

    $ sudo systemctl enable --now docker
    
  6. 启动泊坞窗

    $ sudo systemctl start docker
    
  7. 检查 docker 版本

    $ docker version
    Client: Docker Engine - Community
     Version:           20.10.7
     API version:       1.41
     Go version:        go1.13.15
     Git commit:        f0df350
     Built:             Wed Jun  2 11:56:24 2021
     OS/Arch:           linux/amd64
     Context:           default
     Experimental:      true
    
    Server: Docker Engine - Community
     Engine:
      Version:          20.10.7
      API version:      1.41 (minimum version 1.12)
      Go version:       go1.13.15
      Git commit:       b0f5bc3
      Built:            Wed Jun  2 11:54:48 2021
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          1.4.6
      GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
     runc:
      Version:          1.0.0-rc95
      GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
     docker-init:
      Version:          0.19.0
      GitCommit:        de40ad0
    $
    
于 2021-06-14T02:24:49.580 回答