Yum

如何安裝沒有依賴問題的最新 docker 版本

  • May 9, 2020

為了在 rhel 7.5 版本上安裝 docker,我們準備了以下內容

(來自列表https://download.docker.com/linux/centos/7/x86_64/stable/Packages/),並且只有最新的

curl https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.8-3.el7.x86_64.rpm -o docker.rpm
curl http://mirror.centos.org/centos/7.3.1611/extras/x86_64/Packages/docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm -o containerselinux.rpm
curl http://mirror.centos.org/centos/7.3.1611/extras/x86_64/Packages/docker-ce-cli-19.03.8-3.el7.x86_64.rpm     -o docker-ce-cli.rpm
curl http://mirror.centos.org/centos/7.3.1611/extras/x86_64/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm        -o containerd.io.rpm

文件是:

-rw-r--r--  1 root      root       25697324 May  8 13:17 docker.rpm
-rw-r--r--  1 root      root           7793 May  8 13:18 containerselinux.rpm
-rw-r--r--  1 root      root           7793 May  8 13:21 docker-ce-cli.rpm
-rw-r--r--  1 root      root           7793 May  8 13:24 containerd.io.rpm

不是我們要安裝所有這些

yum localinstall -y  docker-ce-cli.rpm containerselinux.rpm docker.rpm  containerd.io.rpm
   Loaded plugins: langpacks
configuration
   Cannot open: docker-ce-cli.rpm. Skipping.
   Cannot open: containerselinux.rpm. Skipping.
   Examining docker.rpm: 3:docker-ce-19.03.8-3.el7.x86_64
   Marking docker.rpm to be installed
   Cannot open: containerd.io.rpm. Skipping.
   Resolving Dependencies
   --> Running transaction check
   ---> Package docker-ce.x86_64 3:19.03.8-3.el7 will be installed
   --> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-19.03.8-3.el7.x86_64
   --> Processing Dependency: containerd.io >= 1.2.2-3 for package: 3:docker-ce-19.03.8-3.el7.x86_64
   --> Processing Dependency: docker-ce-cli for package: 3:docker-ce-19.03.8-3.el7.x86_64
   --> Finished Dependency Resolution
   Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (/docker)
              Requires: container-selinux >= 2:2.74
   Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (/docker)
              Requires: docker-ce-cli
   Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (/docker)
              Requires: containerd.io >= 1.2.2-3
    You could try using --skip-broken to work around the problem

We  not understand why we get 

   Requires: docker-ce-cli
   Requires: containerd.io >= 1.2.2-3
   Requires: container-selinux >= 2:2.74

由於我們安裝了最新版本

第二

我們也得到

Cannot open: docker-ce-cli.rpm. Skipping.
Cannot open: containerselinux.rpm. Skipping.

但我的捲發有什麼問題?

在我修復並設置正確的 URL 後,我們仍然得到:

yum localinstall  docker.rpm  containerselinux.rpm docker-ce-cli.rpm containerd.io.rpm -y
Loaded plugins: langpacks
Examining docker.rpm: 3:docker-ce-19.03.8-3.el7.x86_64
Marking docker.rpm to be installed
Examining containerselinux.rpm: docker-ce-selinux-17.03.3.ce-1.el7.noarch
Marking containerselinux.rpm to be installed
Examining docker-ce-cli.rpm: 1:docker-ce-cli-19.03.8-3.el7.x86_64
Marking docker-ce-cli.rpm to be installed
Examining containerd.io.rpm: containerd.io-1.2.6-3.3.el7.x86_64
Marking containerd.io.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package containerd.io.x86_64 0:1.2.6-3.3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.2.6-3.3.el7.x86_64
                                                                                                                                                                                                                                                                                                                 | 4.3 kB  00:00:00
---> Package docker-ce.x86_64 3:19.03.8-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-19.03.8-3.el7.x86_64
---> Package docker-ce-cli.x86_64 1:19.03.8-3.el7 will be installed
---> Package docker-ce-selinux.noarch 0:17.03.3.ce-1.el7 will be installed
Removing docker-ce-selinux.noarch 0:17.03.3.ce-1.el7 - u due to obsoletes from docker-ce.x86_64 3:19.03.8-3.el7 - u
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package containerd.io.x86_64 0:1.2.6-3.3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.2.6-3.3.el7.x86_64
---> Package docker-ce.x86_64 3:19.03.8-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-19.03.8-3.el7.x86_64
---> Package docker-ce-selinux.noarch 0:17.03.3.ce-1.el7 will be installed
--> Finished Dependency Resolution
Error: Package: containerd.io-1.2.6-3.3.el7.x86_64 (/containerd.io)
          Requires: container-selinux >= 2:2.74
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (/docker)
          Requires: container-selinux >= 2:2.74
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

containerselinux.rpm, docker-ce-cli.rpm, 並且docker-ce-cli.rpm實際上不是 RPM,而是帶有 404 錯誤的 HTML,因為您使用了錯誤的 URL 來下載它們。刪除它們並從正確的 URL 重新下載它們。

引用自:https://unix.stackexchange.com/questions/585358