linux RHEL 8/Fedora - yum/dns导致无法为docker-ce下载repodata/repomd.xml

wgxvkvu9  于 2022-11-22  发布在  Linux
关注(0)|答案(4)|浏览(131)

问题

如何修复docker-ce的Cannot download repodata/repomd.xml: All mirrors were tried

问题

按照当前(截至2021年12月13日)Docker文档设置Docker yum/dnf存储库,得到错误Cannot download repodata/repomd.xml: All mirrors were triedyum install docker-ce

  • 在Fedora上安装Docker引擎
  • 在RHEL上安装Docker引擎

步骤和错误

$ sudo dnf -y install dnf-plugins-core
Last metadata expiration check: 0:43:20 ago on Wed 15 Dec 2021 03:47:53 AM UTC.
Package dnf-plugins-core-4.0.21-3.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

$ sudo dnf config-manager \
>     --add-repo \
>     https://download.docker.com/linux/fedora/docker-ce.repo
Adding repo from: https://download.docker.com/linux/fedora/docker-ce.repo

$ sudo yum update
Docker CE Stable - x86_64                                                                                                                                                                                             357  B/s | 383  B     00:01    
Errors during downloading metadata for repository 'docker-ce-stable':
  - Status code: 404 for https://download.docker.com/linux/fedora/8/x86_64/stable/repodata/repomd.xml (IP: 13.224.175.42)
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

环境

与8.4和8.5一起复制。但是,其他Fedora/RHEL/CentOS也会有相同的问题。

$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
nkcskrwz

nkcskrwz1#

原因

Docker文档中指定的命令会生成不正确的存储库配置。
根据Changes to dockerproject.org APT and YUM repositories,Docker的存储库现在被移动到download.docker.com。文档链接到Docker文档,例如在Fedora上安装Docker引擎。

我需要做什么?

如果您当前使用的是www.example.com或www.example.com上的APT或YUM存储库dockerproject.orgdockerproject.com,请更新以使用download.docker.com上的存储库。
您可以在文档中找到CentOS、Debian、Fedora和Ubuntu的说明。
请按照以下说明操作:

$ sudo dnf config-manager \
    --add-repo \
    https://download.docker.com/linux/fedora/docker-ce.repo

该命令创建的/etc/yum.repos.d/docker-ce.repo具有错误的URL。

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/stable # <--- Wrong URL
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

Unable to install docker on rhel 8 linux中所述,它应该是:

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable # <--- Correct URL
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

不确定谁应该修复此问题。请告知负责人。

溶液

对于RHEL/Fedora,请使用下面的命令,而不要使用Docker文档中指定的命令。

sudo dnf config-manager \
--add-repo=https://download.docker.com/linux/centos/docker-ce.repo

如果已经创建了不正确的配置。

sed -i -e 's/baseurl=https:\/\/download\.docker\.com\/linux\/\(fedora\|rhel\)\/$releasever/baseurl\=https:\/\/download.docker.com\/linux\/centos\/$releasever/g' /etc/yum.repos.d/docker-ce.repo
jexiocij

jexiocij2#

简化@mon解决方案
编辑此文件/etc/yum.repos.d/docker-ce.repo

If you're using fedora: 
   then compare the example below with your file (make sure 
   you have the word fedora in the baseurl and the gpgkey)

If you're using a different distro (like centos):
   then everywhere that you see the word fedora replace it 
   with the word centos.

例如:

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://download.docker.com/linux/fedora/$releasever/source/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://download.docker.com/linux/fedora/$releasever/source/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://download.docker.com/linux/fedora/$releasever/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/fedora/gpg
9jyewag0

9jyewag03#

我正在运行Centos Stream 9,它是一种不同的动物。就像其他人所说的,我编辑了/etc/yum.repos.d/docker-ce.repo,但不是.../linux/rhel/$releas..而是.../linux/centos/$rel...可能需要将$rel..更改为/8/

yws3nbqq

yws3nbqq4#

RHEL 86x_64x不支持Docker
我看到了一个解决方案,可以在/etc/yum.repos.d/docker-ce****.repo中编辑.repo文件,并将[docker-ce-stable]基本URL编辑为
https://download.docker.com/linux/centos/$releasever/$basearch/stable
Centos将与RHEL一起使用。

相关问题