I am following the steps shown here.
It says to setup a repository by calling:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then install by running:
sudo yum install docker-ce docker-ce-cli containerd.io
When I do that I get the following error:
https://download.docker.com/linux/centos/7Server/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 – Not Found
When I go to that URL, it is a 404. But I am unsure on what the correct URL should be and what to do to get it to use the correct URL.
I am open to any advice on how to get this working.
Update:
Exploring a bit more I found that this URL is probably the one I need to use:
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/repomd.xml
But I don’t know how to get it to use that.
Update 2:
Downloading the file at https://download.docker.com/linux/centos/docker-ce.repo (from the first command) showed that it was getting the 7Server
value from a yum variable called $releasever
.
This page indicates that $releasever
is read from /etc/yum.conf in the setting distroverpkg
. I added a line like this: distroverpkg=7
.
But when I ran the install command again, 7Server
was replaced by $releasever
directly (no substitution happened). The 7
value I was looking for was not substituted in there.
Still stuck on how to get this to download and install docker.
Update 3:
I was able to add a file called releasever
to /etc/yum/vars with the value of 7
in it. When I ran the install command again, it found the repository correctly!
But then it needed to load another URL that broke. It looked like that URL wanted 7Server
instead of 7
as the releasever
variable.
Looks like I am out of luck 🙁
3
Answers
This is an issue with download.docker.com that they have had open since September.
Basically they decided to retire the
7Server
urls. They redirect to the plain7
for the url https://download.docker.com/linux/centos/7Server, but not for any deeper urls.The workaround is to call this:
Before you call the
sudo yum install
command.Due to the test on a fresh centos7, I think the problem is not docker.
Also if I search repomd.xml I found that is a commmon problem in centos when you try to install another tools:
Error: Cannot retrieve repository metadata (repomd.xml)
As you will see in the question, the problem is related to rare behaviors in the centos s.o like: repos, certificates, updates, etc
Maybe this helps you:
Also If you don’t want a headache, delete your centos and create a new one!
do this for centos 7
go to cd /etc/yum.repos.d/
and delete all other repositories except centos related repositories.
goto docker official website and follow the install instructions again.
It works for me