Installing Docker on CentOS 6.x

Docker — Image Credits: marketplace.automic.com
CentOS- Image Credits: www.rosehosting.com

In order to install Docker on CentOS 6.x it is necessary to update the CentOS 6.x kernel. However, compiling your own kernel can be a mess. Instead, you could use the kernels maintained at the ELRepo Project which is an RPM repository for Enterprise Linux Packages. ELRepo supports Red Hat Linux (RHEL) and its derivatives such as CentOS, Scientific Linux and others.

First you need to enable the ELRepo Project repository as follows: (by importing the public key)

rpm — import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm

Then you need to install the kernel as follows:

sudo yum — enablerepo=elrepo-kernel install kernel-lt

Next you need to configure grub. You can open up grub in gedit with the following command ( or in a suitable text editor of your choice.)

sudo gedit /etc/grub.conf

The kernel order needs to be changed in the grub.conf. This is done by changing default = 1 to default = 0 and must look similar to the below.

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (3.10.55–1.el6.elrepo.x86_64)

root (hd0,0)

kernel /vmlinuz-3.10.55–1.el6.elrepo.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=br-abnt2 rhgb quiet

Then all you have to do is reboot and voila you have a fresh kernel on CentoOS! To reboot use the following command:

sudo reboot

So now that you have updated your CentOS kernel it is time to install Docker on it. To do this add the Enterprise Linux repo (EPEL) , which is a community repository of non-standard packages for the RHEL distribution. Install the EPEL repository as follows:

rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Then as a best practice update your packages as follows:

sudo yum update -y

Now you can install Docker by installing the docker-io package:

sudo yum -y install docker-io

Congratulations!! Docker is now installed on your Centos 6.x machine. Once the installation completes, check that the docker daemon works by running,

sudo docker -d

My next post will deal with how to build and install Tensorflow on CentOS 6.x now that you have installed Docker on your machine.