How to Install Docker on RedHat/CentOS

0
2552
How to Install Docker

Docker is supported on Red Hat Enterprise Linux and CentOS 7. Here is the steps to install Docker using yum installer. Using these packages ensures you get the latest release of Docker. If you wish to install using Red Hat-managed packages, consult your Red Hat release documentation for information on Red Hat’s Docker support.

Prerequisites

Docker requires a 64-bit installation regardless of your Red Hat version. Docker requires that your kernel must be 3.10 at minimum, which Red Hat 7 runs.

To check your current kernel version, use uname -r

# uname -r

3.10.0-229.el7.x86_64

Read More: How to install Docker on Ubuntu

Step 1: Search Dependencies

We can install docker using two methods, One yum or we can use curl with get.docker.com. Here let we install with yum first

Before start install make you required dependency is there by using yum search

# yum search docker

docker search

Step 2: Creating Repo (if you got last step output skip this, goahead with step 3)

Once we get the dependency we can start install. If you cannot find we need create repo file for the docker file. If you cannot get the docker dependency, follow this step. Or you can skip this

Before you create or install docker, make sure your server updated, for update use

# yum update

Once system updated, now create repo file called /etc/yum.repos.d/docker.repo

# vim /etc/yum.repos.d/docker.repo

[dockerrepo]

name=Docker Repository

baseurl=https://yum.dockerproject.org/repo/main/centos/7

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

Step 3: Installing Docker

Now we install docker using yum

# yum install docker-engine -y

To enable docker in bootup

# systemctl enable docker.service

To start docker service

# service docker start

Step 4: Verify Docker

To verify docker is working on, we can use hello-world to verify

# docker run hello-world

docker hello world

How to Create Dockerized App

Here let we see how we can create simple dockerized application.

Normally we install a package using yum in redhat/centos and apt-get in debain based OS etc. Here we can create a app with particular OS with valid commend. For example let we create app for install apache in centos.

In centos we use yum install to install a package. Same we use in docker with docker run

# docker run -d centos yum install httpd

Here

run – will check local system, if there is no detail it will get from online and perform the action

-d – d is using for check with dependency

Centos – which image app going to run

To Check Container ID

# docker ps

NO COMMENTS

LEAVE A REPLY