Vaccano
Vaccano

Reputation: 82291

Can install docker with yum on centos 7

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 :(

Upvotes: 3

Views: 9928

Answers (4)

João Silva
João Silva

Reputation: 1

Same issue here. In my case it was having troubles finding the $releasever. Managed to fix it by editing the docker-ce.repo with:

sudo vi /etc/yum.repos.d/docker-ce.repo

and replaced all the $releasever with 7, making it look like this:

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://download.docker.com/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://download.docker.com/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://download.docker.com/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

Upvotes: 0

ARUN RAJ
ARUN RAJ

Reputation: 1

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

Upvotes: 0

Vaccano
Vaccano

Reputation: 82291

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 plain 7 for the url https://download.docker.com/linux/centos/7Server, but not for any deeper urls.

The workaround is to call this:

sudo yum-config-manager --setopt="docker-ce-stable.baseurl=https://download .docker.com/linux/centos/7/x86_64/stable" --save

Before you call the sudo yum install command.

Upvotes: 2

JRichardsz
JRichardsz

Reputation: 16495

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:

yum clean all
yum check
yum erase apf
yum update ca-certificates
yum upgrade

Also If you don't want a headache, delete your centos and create a new one!

Upvotes: -1

Related Questions