10

For some time, the docker-io package has been used to install Docker on CentOS 6.

Since early this month, this package no longer appears to be available:

[root@e0-01.p:0 yum.repos.d]# yum install docker-io
Loaded plugins: fastestmirror, presto
Setting up Install Process
Determining fastest mirrors
 * base: mirror.intergrid.com.au
 * extras: mirror.ventraip.net.au
 * updates: mirror.ventraip.net.au
base                                                                 | 3.7 kB     00:00
base/primary_db                                                      | 4.7 MB     00:00
epel                                                                 | 4.7 kB     00:00
epel/primary_db                                                      | 6.0 MB     00:00
extras                                                               | 3.4 kB     00:00
extras/primary_db                                                    |  28 kB     00:00
updates                                                              | 3.4 kB     00:00
updates/primary_db                                                   | 3.2 MB     00:00
No package docker-io available.
Error: Nothing to do

docker-io was previously part of the epel repository and has been the recommended way to install Docker (albeit, an older version) on CentOS 6 in a number of places.

Is there any other way Docker can be installed on CentOS 6?

Tim Malone
  • 3,364
  • 5
  • 37
  • 50

6 Answers6

13

This version finally installed OK

wget https://yum.dockerproject.org/repo/main/centos/6/Packages/docker-engine-1.7.1-1.el6.x86_64.rpm
sudo rpm -ivhf docker-engine-1.7.1-1.el6.x86_64.rpm
sudo service docker start

System

Linux host.my-domain.com 2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

  • 3
    Note that on my machine, I also had to do `yum install libcgroup` – rinogo Nov 09 '19 at 18:04
  • 6
    `https://yum.dockerproject.org/repo/main/centos/6/Packages/docker-engine-1.7.1-1.el6.x86_64.rpm` is a dead link. Answer by Tim Malone has up-to-date url pattern. – user7610 Jan 15 '20 at 15:23
9

I'm not sure why docker-io suddenly disappeared, but the same version previously available through the epel repository can be installed directly from this rpm hosted by Docker:

[root@server]# yum install
https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

[root@server]# docker --version
Docker version 1.7.0, build 0baf609
user7610
  • 25,267
  • 15
  • 124
  • 150
Tim Malone
  • 3,364
  • 5
  • 37
  • 50
  • 1
    Are you sure that is exactly the same previously-available version? My yum says it has `1.7.1-2.el6`, and your link unfortunately doesn't install cleanly for me (it for some reason doesn't see dependencies in `/usr/lib64`??). – eclarkso Apr 17 '19 at 17:01
  • Hmm it installed cleanly for me, but that was on a fresh server. I don’t suppose it works if you change the version in the URL? – Tim Malone Apr 17 '19 at 20:56
  • 1
    I had tried 1.7.1-2 (what yum reported I have on other machines from `docker-io`) and that gave 403 FORBIDDEN. But at your prompting, I tried `wget https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm` and that works. The [release notes](https://docs.docker.com/release-notes/docker-engine/#171-2015-07-14) indicate it's probably worth editing the answer to the later point release, though I hope neither we nor others will be using RHEL6 much longer! – eclarkso Apr 17 '19 at 21:36
  • I'm very curious what prompted this weird change! You didn't mention it, but docker is still in EPEL, it's just called `docker` and is even older at v1.5-5... – eclarkso Apr 17 '19 at 21:41
  • 1
    This answer worked for me by adding `--setopt=obsoletes=0` flag when running yum installation. – Andrej Apr 27 '20 at 12:52
2

You should install docker-engine from epel-release:

  1. Add docker repository for installing latest copy of Docker for Centos 6

Update, install epel repo then create a repo called docker.repo and fill in the information for docker repo:

[user@docker7 ~]# sudo yum update -y
[user@docker7 ~]# sudo yum install epel-release
[user@docker7 ~]# sudo vi /etc/yum.repos.d/docker.repo

[docker-repo]
name=Docker Repo
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
  1. Install docker package, then enable the service to start upon reboot, also start the docker service.

Now install docker-engine and enable docker to start at boot with systemctl. Then enable docker command and also start docker with systemctl start docker

              For centos 7 
[user@docker7 ~]$ sudo yum install -y docker-engine
[user@docker7 ~]$ sudo systemctl enable docker
[user@docker7 ~]$ sudo systemctl start docker
[user@docker7 ~]$ sudo systemctl status docker

              For centos 6 
[user@docker7 ~]$ sudo chkconfig docker on 
[user@docker7 ~]$ sudo service docker start 
[user@docker7 ~]$ sudo service docker status

[user@docker7 ~]$ ps aux | grep docker
root      2382  0.3  1.4 498424 26536 ?        Ssl  20:17   0:00 /usr/bin/dockerd
root      2385  0.0  0.2 263104  5568 ?        Ssl  20:17   0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc

3.Manage Docker as a non-root user

  • The step by step instructions are fantastic, but the url is dead. @Tim Malone's URL still works – Andy Jul 02 '20 at 20:56
2

Version 1.7.0 has a bug, preventing the docker daemon from starting on CentOS 6.x:

level=warning msg="Running modprobe bridge nf_nat failed with message: , error: exit status 1"
level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: operation not supported"

In order to fix use version 1.7.1:

yum install https://yum.dockerproject.org/repo/main/centos/6/Packages/docker-engine-1.7.1-1.el6.x86_64.rpm
1

The latest docker engine's version for CentOS 6 is 1.7.1, and the available URL is https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm. Unfortunately, this rpm file can't be installed by the "yum install" command now. You can use the "rpm" command after downloading the file.

Libcgroup is needed by docker-engine, you can find it from https://vault.centos.org.

wget https://vault.centos.org/6.6/os/x86_64/Packages/libcgroup-0.40.rc1-12.el6.x86_64.rpm
sudo rpm -ivhf libcgroup-0.40.rc1-12.el6.x86_64.rpm
wget https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
sudo rpm -ivhf docker-engine-1.7.1-1.el6.x86_64.rpm
sudo service docker start
Liam Mazy
  • 390
  • 3
  • 15
0

Can use this url https://mirrors.tuna.tsinghua.edu.cn/docker/yum/repo/centos6/Packages/ and choose the version of docker-engine rpm x86-64 for download

Then, you can do some like this:

sudo yum install localinstall docker-engine-1.7.1-1.el6.x86_64.rpm