已安装仓库但`yum list available`中未显示出docker-ce

3
提示:虽然我已经通过直接安装单个rpm文件而不是依靠yum来解决了这个问题,但我仍希望能够回答这个问题。
我在CentOS 7上安装docker-ce遇到了困难。我已经在其他三台机器上安装了它,但第四台机器却出现了问题。我按照这里的说明进行操作。安装存储库似乎可以工作,但是无论我尝试什么,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系统复制了这个代码库(因为在那个系统上它可用),我仍然看不到docker-ce软件包。这个代码库今晚在其他三台机器上都能正常工作。
如果有帮助将不胜感激。提前感谢!
编辑:
运行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

1
尝试运行yum clean all,然后安装它。 - LinPy
很遗憾,那样做并没有解决问题。我仍然只在存储库中看到containerd.io,没有其他内容。不过还是谢谢你! - Vorticity
此外,请查看问题末尾的编辑。 - Vorticity
1
你可以尝试执行 yum --disablerepo="*" --enablerepo="docker-ce-stable" --disableexcludes=all list available 命令吗? - Eduardo Baitello
@EduardoBaitello 显然有人将 exclude=docker* 添加到了 /etc/yum.conf 中。问题解决了!由于您的评论引导我找到了答案,如果您提交一个答案,我会接受它。 - Vorticity
显示剩余6条评论
4个回答

6

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

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

--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列出可用内容


看起来我现在还不能颁发赏金。它说我需要等待7个小时。那时候我会颁发的。 - Vorticity

0

请尝试以下步骤:

  • 创建目录/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

谢谢您的建议。虽然它没有意义,但我得到了与之前相同的结果。我想我只需要从头开始处理这个问题。 - Vorticity
你能提供 yum repolist -v docker-ce-stable 的输出吗? - lainatnavi

0

你的回答可以通过提供更多支持信息来改进。请编辑以添加进一步的细节,例如引用或文档,以便他人可以确认你的答案是正确的。您可以在帮助中心找到有关如何编写良好答案的更多信息。 - Community

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接