docker-ce 没有出现在安装了 repo 的 `yum list available` 中

docker-ce not showing up in `yum list available` with repo installed

编辑:如果可能的话,我仍然想要这个问题的答案,但我已经设法通过直接安装各个 rpm 而不是依靠 yum 为我完成它来解决这个问题。

我正在努力在 CentOS 7 机器上安装 docker-ce。我将它安装在其他三个盒子上,但第四个给我带来了问题。我正在按照说明 here 进行操作。安装 repo 似乎有效,但 docker-ce 似乎无法使用,无论我如何尝试。

$ sudo yum-config-manager \
>     --add-repo \
>     https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

$ ls /etc/yum.repos.d/docker-ce.repo
/etc/yum.repos.d/docker-ce.repo

# This should include docker-ce, docker-ce-cli, and a few other things
$ yum --disablerepo="*" --enablerepo="docker-ce-stable" list available
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Packages
containerd.io.x86_64                                 1.2.6-3.3.el7                                  docker-ce-stable

$ sudo yum install docker-ce
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fileplanet.com
 * epel: mirror.colorado.edu
 * extras: mirrors.tummy.com
 * updates: mirrors.tummy.com
No package docker-ce available.
Error: Nothing to do

回购显然已启用。我可以从仓库安装 containerd.io。回购协议中似乎没有其他可用的东西。即使当我从另一个运行的 CentOS7 机器上复制 repo 时,我仍然看不到 docker-ce 软件包。这个 repo 今晚在其他三个盒子上运行良好。

如有任何帮助,我们将不胜感激。提前致谢!

编辑:

运行 yum clean allyum update 没有帮助。

$ rm /etc/yum.repos.d/docker-ce.repo
rm: remove regular file ‘/etc/yum.repos.d/docker-ce.repo’? y

$ yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras updates
Cleaning up list of fastest mirrors
Other repos take up 18 M of disk space (use --verbose for details)

$ yum update
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
epel/x86_64/metalink                                                                         |  14 kB  00:00:00
 * base: repos.forethought.net
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: repos.forethought.net
 * updates: repos.forethought.net
base                                                                                         | 3.6 kB  00:00:00
epel                                                                                         | 5.4 kB  00:00:00
extras                                                                                       | 2.9 kB  00:00:00
updates                                                                                      | 2.9 kB  00:00:00
(1/7): base/7/x86_64/group_gz                                                                | 165 kB  00:00:00
(2/7): base/7/x86_64/primary_db                                                              | 6.0 MB  00:00:00
(3/7): epel/x86_64/group_gz                                                                  |  90 kB  00:00:00
(4/7): epel/x86_64/updateinfo                                                                | 1.0 MB  00:00:00
(5/7): extras/7/x86_64/primary_db                                                            | 153 kB  00:00:00
(6/7): updates/7/x86_64/primary_db                                                           | 2.8 MB  00:00:00
(7/7): epel/x86_64/primary_db                                                                | 6.9 MB  00:00:01
No packages marked for update

$ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

$ yum list available | grep docker-ce
containerd.io.x86_64                      1.2.10-3.2.el7                 docker-ce-stable

$ yum install docker-ce
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: repos.forethought.net
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: repos.forethought.net
 * updates: repos.forethought.net
No package docker-ce available.
Error: Nothing to do
$ yum --disablerepo="*" --enablerepo="docker-ce-stable" list available
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Packages
containerd.io.x86_64                                 1.2.10-3.2.el7                                 docker-ce-stable

请尝试以下步骤:

  • 创建目录 /etc/yum.repos.d/disabled 并将所有内容从 /etc/yum.repos.d 移动到这个新目录
  • 运行yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo。现在您应该在 /etc/yum.repos.d.
  • 下看到一个 docker-ce.repo 文件
  • 运行 yum clean all && yum list available 然后检查你是否看到 docker-ce.x86_64 个可用包

有很多方法可以强制 yum 排除存储库。其中之一是在 /etc/yum.conf 上设置 exclude 指令。此配置优先于 --disablerepo--enablerepo 标志。

您必须检查您的 /etc/yum.conf,删除排除 强制 yum 使用 --disableexcludes=all 标志忽略它。

--disableexcludes=[all|main|repoid]
Disable  the excludes defined in your config files. Takes one of three options:

all == disable all excludes
main == disable excludes defined in [main] in yum.conf
repoid == disable excludes defined for that repo

例如:

yum --disablerepo="*" --enablerepo="docker-ce-stable" --disableexcludes=all list available

执行下面的命令试试看。

yum 安装-y yum-utils device-mapper-persistent-data lvm2

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.rep

尝试安装时不带斜杠''

错误 - sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo

右 - sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo