How To Install Docker On CentOS/RHEL 6/7 And Learn Docker HUB Registration

0
173
views
How To Install Docker On CentOS/RHEL 6/7 And Learn Docker HUB Registration

Docker can be installed easily and it is available for almost every Linux distro’s and other OS(s) like Windows or Mac. Docker can also be compiled on the local system itself with the use of source code present on GitHub. Also, there are pre-compiled packages for Docker. It can be installed on the Host Machine OS or on a Virtual Machine.

As I mentioned that Docker can be installed on the Host Machine OS or on a Virtual Machine so it’s up to you what you gonna do. But before moving further with installation process you may like read about Docker, its components, and benefits

Part 1: What Is Docker And Concept Of Containers With Virtualization?
Part 3A: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 A
Part 3B: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 B
Part 4: How To Perform Task Like Install, Run And Delete Applications Inside Docker Containers

So let’s start

Scenario :

Host OS: CentOS 7 x86_64
RAM: 4GB memory,
Network Port:  1GB/s
HDD: 1000GB of disk space.

Prerequisite:

  1. Disabled the SELinux and FirewallD services
  2. We will pull the Docker-relevant packages from the repo, so provide proxy details.

 Note: –  If the system is behind the proxy, then ensure that HTTP_PROXY and HTTPS_PROXY are defined in the configuration file /etc/sysconfig/docker

Note: This tutorial is for the scenario mentioned above but commands and steps for RHEL/CentOS 6/7 are same.

Step 1: Install EPEL Repository

For the installation of Docker, we required EPEL (Extra Packages for Enterprise Linux) repository pre-configured on CentOS/RHEL 6. But, If you are running a CentOS/RHEL 7 then you don’t need to install EPEL because CentOS 7 already have all packages required for Docker installation.

For RHEL/CentOS 6 32-64 Bit

#wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm# 
#rpm -ivh epel-release-6-8.noarch.rpm

For RHEL/CentOS 6 64-Bit

#wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm

Step 2:  Perform Docker Installation

We have completed and finished our dependencies and now we can move forward with Docker installation with following commands

For CentOS/RHEL 7

# yum install docker 
# yum install device-mapper-event-libs

For RHEL 6

# yum install docker-io
# yum install device-mapper-event-libs



Step 3: Start/Enable Docker Service

As we have successfully installed Docker and service, we need to start its service. For starting docker we need will use the following sets of command for CentOS/RHEL 6/7. Also we ill enable the service for current runlevel(s).

For RHEL/CentOS 7

# systemctl start docker.service
# systemctl status docker.service
# systemctl enable docker.service

For RHEL/CentOS 6

# service docker start
# service docker status
# chkconfig docker on

Step 4: Verify Installation

As we have a successful installation and a running service of Docker, we can verify its presence with two methods

1 . Checking Version 

# docker -v
Docker version 1.12.6, build 1398f24/1.12.6

2. Saying Hello 🙂 To Docker

# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

If you could See this then Your Docker installation is a success and its verified.

Now if you want to pull images(CentOS, Ubuntu etc.) from the Docker Hub then you need to complete a registration process on Docker HUB.  After successful registration, those credentials will be used for several other purposes too, other just pulling images from HUB.

Once the registration is done, use the command docker login to log into the hub. (We will use this in Next Article)

But For Now A Quick Guide for  Docker Registration

Docker Hub is a registry service on the cloud that allows you to download Docker images that are built by other communities. You can also upload your own Docker built images to Docker hub.

Step 1: Follow the Link For Docker HUB  (https://hub.docker.com/) And Complete The Form

How to Install Docker on CentOS/RHEL 6/7 and Learn Docker HUB Registration

Step 2:- Active Your Account after clicking on the link you got in your Activation Email on your Email ID

Step 3: – After Logging in you Docker HUB Interface Be like this

How to Install Docker on CentOS/RHEL 6/7 and Learn Docker HUB Registration

We will continue to Docker command usage in next tutorials and we will create or own containers and images and try to explore more.


Read More:

Part 1: What Is Docker And Concept Of Containers With Virtualization?
Part 2: How To Install Docker On CentOS/RHEL 6/7? And Learn Docker HUB Registration
Part 3A: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 A
Part 3B: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 B
Part 4: How To Perform Task Like Install, Run And Delete Applications Inside Docker Containers