dnf cannot download repomd.xml for the docker-ce repository on RHEL or Fedora
Cannot download repodata/repomd.xml for the docker-ce repositoryShort 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.
Fix it fast
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.repo2Match what you see, then jump to its fix
- 1
baseurl contains /linux/centos/ while the machine runs RHEL or FedoraThe repo file was made for another distributionFix - 2
The 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
Every repo times out, or only download.docker.com fails while a local mirror worksThe machine reaches the internet only through a proxyFix
- 1
What does the error look like?
Cannot download repodata/repomd.xml for the docker-ce repositorydnf 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.repo2Fix
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.repo3Verify
dnf can now read the metadata.
sudo dnf makecacheConfirmed by docs.docker.com
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 %rhel2Fix
Move to a release on the supported list (upgrade the OS), then run the repo setup again.
sudo dnf makecache3Verify
docker-ce-stable shows up in the repo list without an error.
dnf repolist | grep -i dockerConfirmed by docs.docker.com
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:31283Verify
dnf fetches the metadata through the proxy.
sudo dnf makecacheConfirmed by dnf.readthedocs.io
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
Servers
dnf fails to download repo metadata in a CentOS 8 Docker build
The same Dockerfile built fine before 2022
CentOS Linux 8 reached end of life on 31 December 2021 and its content left the mirrors.
2 causes, each with a fixServers
yum or dnf on an EC2 instance cannot download from the Amazon Linux repository
dnf cannot download repository metadata on an instance with no internet route
Amazon Linux repositories live in S3.
2 causes, each with a fixServers
apk cannot find py-pip in an Alpine Docker image
py-pip (no such package):
On current Alpine releases there is no package called py-pip.
2 causes, each with a fixServers
ng serve runs in the container but localhost:4200 does not open
The browser cannot open localhost:4200 although ng serve is running in the container
ng serve listens on localhost by default, which inside a container is the container itself.
3 causes, each with a fixServers
Angular routes return 404 from nginx when you refresh or open a link
The home page loads, but refreshing /some/route shows an nginx 404
Angular routes like /users/42 are not files, so nginx looks for them on disk and returns 404.
3 causes, each with a fixServers
AH00558: Apache in Docker cannot reliably determine its fully qualified domain name
Set the 'ServerName' directive globally to suppress this message
AH00558 is a warning, not a crash.
2 causes, each with a fix