Question
How to fix the Cannot download repodata/repomd.xml: All mirrors were tried
for docker-ce.
Problem
Get the error Cannot download repodata/repomd.xml: All mirrors were tried
with yum install docker-ce
by following the current (as of 2021DEC13) Docker documentations to setup Docker yum/dnf repositories.
Steps & Error
$ 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
Environment
Reproduced with 8.4 and 8.5. However, other Fedora/RHEL/CentOS would have the same issue.
$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
4
Answers
Cause
The commands specified in the Docker documentations generates incorrect repository configurations.
As per Changes to dockerproject.org APT and YUM repositories, the repository for docker is now moved to
download.docker.com
. The document links to the Docker documentations such as Install Docker Engine on Fedora.You follow the instruction:
The command creates
/etc/yum.repos.d/docker-ce.repo
which has wrong URL.As explained in Unable to install docker on rhel 8 linux, it should have been:
Not sure who should fix this. Please advise who is in charge.
Solution
Use the command below for RHEL/Fedora instead of the one specified in the Docker documentation.
If the incorrect configuration has been already created.
To simplify @mon solution
edit this file
/etc/yum.repos.d/docker-ce.repo
example:
I am running Centos Stream 9, which is a different animal. Like the others had said, I edited /etc/yum.repos.d/docker-ce.repo
But instead of …/linux/rhel/$releas..
change to …/linux/centos/$rel…
It may be that need to change $rel.. to /8/
docker is not supported for RHEL 86x_64x
i saw a solution to edit the .repo file inside /etc/yum.repos.d/docker-ce****.repo and edit the [docker-ce-stable] baseurl to
https://download.docker.com/linux/centos/$releasever/$basearch/stable
centos will work with RHEL.