Docker CE Installation on Red Hat 7

Docker CE is not officially supported on RHEL but you can get the latest Docker CE installed on it.

Here are the steps.

Step 1 : Install yum-utils and epel-release.

yum-utils

# yum install -y yum-utils

epel-release

# wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
--2018-03-24 10:28:49-- http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.25, 209.132.181.23, 209.132.181.24
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.25|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15080 (15K) [application/x-rpm]
Saving to: ‘epel-release-latest-7.noarch.rpm’

100%[==========================================================================================================================>] 15,080 57.0KB/s in 0.3s

2018-03-24 10:28:50 (57.0 KB/s) - ‘epel-release-latest-7.noarch.rpm’ saved [15080/15080]

#
# rpm -ivh epel-release-latest-7.noarch.rpm

Step 2 : Add Docker CE to yum repos.

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

Before docker-ce installation, we should install container-selinux. If not docker-ce will fail due to container-selinux dependencies. 

Also, if epel-release package not installed, then also docker-ce will fail with below error.

Error: Package: docker-ce-18.03.0.ce-1.el7.centos.x86_64 (docker-ce-stable) Requires: pigz

Step 3: Install container-selinux package.

# yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.33-1.git86f33cd.el7.noarch.rpm

Step 4: Install Docker CE

# yum install -y docker-ce
# docker --version
Docker version 18.03.0-ce, build 0520e24
#

Step 5: Restart docker service and enable it.

# systemctl restart docker
# systemctl enable docker 
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

Step 5: Now run nginx container to test.

# docker run --name webserver -d -p 9090:80 nginx

Now check in web browser with below url

http://your-IP-address:9090/

nginx.PNG

Advertisements

7 thoughts on “Docker CE Installation on Red Hat 7

  1. Hi Zor,

    Are you installing docker ce on cloud or in your local machine ?

    If you are installing in your local machine, as the RedHat is not a free distribution, we need to purchase a licence and activate it.

    If you want to try in cloud, signup to AWS Free tier account and create VM with redhat 7 image.

    Once your task done, terminate the VM to avoid charges.

    Liked by 1 person

Post your Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s