Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

dnf cannot download repomd.xml for the docker-ce repository on RHEL or Fedora

ErrorCannot download repodata/repomd.xml for the docker-ce repository

Short answer

dnf asks the docker-ce repo for repomd.xml and gets no usable answer. Look at the baseurl inside the docker-ce repo file first. Docker publishes a separate repo per distribution, so a CentOS file on RHEL or Fedora, an unsupported release, or a blocked proxy are the usual reasons.

  • Applies to RHEL 9, Fedora 43, Docker Engine docker-ce repo
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the OS name and the URL the repo file uses. The path in baseurl must name your distribution (rhel or fedora).

    grep -E '^(ID|VERSION_ID)=' /etc/os-release
    grep -H -E '^(name|baseurl)=' /etc/yum.repos.d/docker-ce.repo
  2. 2Match what you see, then jump to its fix

    1. 1baseurl contains /linux/centos/ while the machine runs RHEL or FedoraThe repo file was made for another distributionFix
    2. 2The repo file is correct for your distribution, but your release is not on Docker's listThe operating system release is not one Docker supportsFix
    3. 3Every repo times out, or only download.docker.com fails while a local mirror worksThe machine reaches the internet only through a proxyFix

What does the error look like?

  • Cannot download repodata/repomd.xml for the docker-ce repository
  • dnf install docker-ce fails while downloading metadata for the docker-ce repo

Cause 1 of 3

The repo file was made for another distribution

1Check

Docker publishes one repo file per distribution. A file copied from a CentOS guide points at a path that does not serve your system.

grep -H baseurl /etc/yum.repos.d/docker-ce.repo

2Fix

Delete the wrong file and add the one Docker documents for your system. On RHEL use the rhel repo; on Fedora use the fedora repo.

sudo rm /etc/yum.repos.d/docker-ce.repo
# RHEL
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
# Fedora
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo

3Verify

dnf can now read the metadata.

sudo dnf makecache

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 3

The operating system release is not one Docker supports

1Check

Docker's install pages name the releases they support (RHEL 8, 9 and 10, and a short list of recent Fedora releases). A pre-release or an end-of-life Fedora is often outside that list. dnf builds repo URLs from its release variable, which it reads from the RPM database.

rpm -E %fedora
rpm -E %rhel

2Fix

Move to a release on the supported list (upgrade the OS), then run the repo setup again.

sudo dnf makecache

3Verify

docker-ce-stable shows up in the repo list without an error.

dnf repolist | grep -i docker

Confirmed by docs.docker.com

Did this fix it?

Cause 3 of 3

The machine reaches the internet only through a proxy

1Check

dnf has its own proxy setting. A shell variable is not always seen by the service or sudo that runs dnf.

grep -R -n '^proxy' /etc/dnf/dnf.conf /etc/yum.repos.d/

2Fix

Set the proxy in the [main] section of /etc/dnf/dnf.conf, or in the one repo section that needs it. An empty proxy= in a repo section turns off the proxy inherited from [main].

# /etc/dnf/dnf.conf
[main]
proxy=http://proxy.example.com:3128

3Verify

dnf fetches the metadata through the proxy.

sudo dnf makecache

Confirmed by dnf.readthedocs.io

Did this fix it?

How do I stop it coming back?

  • Take the repo URL from Docker's install page for your own distribution, not from a guide written for another one.
  • Check the supported releases before you upgrade a server to a new Fedora or RHEL version.
  • Keep proxy settings in /etc/dnf/dnf.conf so every dnf run sees them.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.