RHEL8/Fedora - yum/dnf causes cannot download repodata/repomd.xml for docker-ce
Asked Answered
H

6

27

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)"
Hooge answered 15/12, 2021 at 5:0 Comment(1)
Answer in this thread worked for me #59994133 -Hummingbird
H
58

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.

What do I need to do?

If you are currently using the APT or YUM repositories from dockerproject.org or dockerproject.com, please update to use the repositories at download.docker.com.

You can find instructions for CentOS, Debian, Fedora and Ubuntu in the documentation.

You follow the instruction:

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

The command creates /etc/yum.repos.d/docker-ce.repo which has wrong 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

As explained in Unable to install docker on rhel 8 linux, it should have been:

[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

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.

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

If the incorrect configuration has been already created.

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

Note

enter image description here

We currently only provide packages for RHEL on s390x (IBM Z). Other architectures are not yet supported for RHEL, but you may be able to install the CentOS packages on RHEL. Refer to the Install Docker Engine on CentOS page for details.

The docker package is not shipped or supported by Red Hat for Red Hat Enterprise Linux (RHEL) 8 and (RHEL) 9. The docker container engine is replaced by a suite of tools in the Container Tools module.

Podman is an excellent alternative to Docker containers when you need increased security, unique identifier (UID) separation using namespaces, and integration with systemd. In this article, I use real-world examples to show you how to install Podman, use its basic commands, and transition from the Docker command-line interface (CLI) to Podman.

Hooge answered 15/12, 2021 at 5:0 Comment(3)
Is the Docker documentation invalid?Biquarterly
@KevinC for rhel8+, yes it isTriphylite
PR Docker docs then.Maleficent
C
3

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 Docker.

Crowd answered 21/11, 2022 at 18:58 Comment(2)
Docker does support RHEL and fedora, there is an error in the documentation and in the repository scripts, but with some workarounds it works. The solution you speak of is part of the full solution, please elaborate further on your answer, and preferably try it yourself first, just to be sure and give as useful an answer as possible.Matejka
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Malvina
S
1

To simplify @mon solution

edit this file /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.

example:

[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
Suez answered 11/7, 2022 at 20:4 Comment(0)
P
0

Try this process. It works. From Ec2 having DNS issue with docker repository.

  1. sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

  2. sudo chmod +x /usr/local/bin/docker-compose

  3. docker-compose --version

Pena answered 31/5, 2023 at 19:26 Comment(1)
This worked for me on Amazon Linux, thanks. Don't forget to give credit linking to the source article.Accrue
P
0

A new note has been added in the documentation.

We currently only provide packages for RHEL on s390x (IBM Z). Other architectures are not yet supported for RHEL, but you may be able to install the CentOS packages on RHEL. Refer to the Install Docker Engine on CentOS page for details.

It seems that currently, packages for architectures other than s390x (IBM Z) are not provided for RHEL. However, you may have an alternative solution by installing the CentOS packages on RHEL. You can refer to the Install Docker Engine on CentOS page for detailed instructions on how to proceed with the installation.

Pooi answered 28/6, 2023 at 14:17 Comment(0)
P
-1

Docker wont work in Rhel we can try using same like centos. https://docs.docker.com/engine/install/centos/

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


sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

once done do sudo service docker start

and then check docker version

Placoid answered 31/5, 2023 at 7:50 Comment(2)
The document says: you may be able to install the CentOS packages on RHEL. Refer to the Install Docker Engine on CentOS page for details. and did not say "will not work".Hooge
@Hooge We currently only provide packages for RHEL on s390x (IBM Z). Other architectures "are not yet supported for RHEL", but you may be able to install the CentOS packages on RHEL. Refer to the Install Docker Engine on CentOS page for details.Placoid

© 2022 - 2024 — McMap. All rights reserved.