Intrduction

As per Wikipedia
Docker is Open-Source project that automates the deployment of application inside software containers. It is promoted by company Docker, Inc.
Docker_docs

Very well define,Docker is OpenSource project written in Go that use to develop, ship and automates the deployment of application inside software container, this help developers and sysadmins to manage their application in testing or sandbox environments that enables to deliver infrastructure applications quickly and easily.
Docker can package and run the application in isolated environments that called containers.
These containers could move, transport and share from one system to another in the very effective manner with very minimum dependencies and usage of resources on Host machines, unlike virtual machines.

Containers

These containers are lightweight virtual machine instance which could run, copy, modify, save and move to another machine as well.
As they are run within host machine kernel, they don't put the much extra load on the hypervisor and can run more containers on given hardware than virtual machines.
This way Docker used widely for development and once the application is ready to deploy, we can move it to the production environment.
This works same as it working on Development environments because it is working in an isolated environment.

It's a great open source effort, that gives automation a new lease of life. You'll think of it as another way of virtualization but it's far superior.
With virtualization (VMWare, KVM, etc) you need to have Guest OS over which different apps get installed but with Docker no more concerned for multiple Guest OS copies, instead of more concerned with libraries and packages required to run the apps.

Docker's magic lies with cgroups, namespaces and some file system work. It helps you to automate applications deployment using containers.
Containers give you a feel of 'chroot' environment as every container have its own process groups, network interfaces, etc. Cgroups controls containers resource utilization while Namespaces control containers view.

Docker Engine

Docker Engine is Client-Server architecture having...

  • Server is daemon process running as a service, which could run on boot.
  • Docker client which needs to connect with docker server. This could connect to local or remote system to run docker instance.
  • REST API that specifies interfaces to programs for use to talk to the daemon and instruct it what to do
  • Docker commands used to work on docker containers. These use REST API to work on docker daemon to control or interact docker instance

Above was an small intro with container. I think now we should start work in ground to see how it work and help Developers and Sysadmins in real enviorment.
As every Great IT product now docker also start releasing its version in two editions. Community Edition (CE) and Enterprose Endition (EE). complete details of Editions and supported platforms listed on link

Installation of Docker on CentoS/Redhat

Here for this setup we are wokring on CentOS7.

[root@srv7 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

Addition of EPEL

Let's try to understand how we can install Docker on CentOS/Redhat distributions. Docker is Extra Packages for Enterprose Linux. So we should first add EPEL repository for Docker installation

rpm -iUvh  http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

now we could install docker from EPEL with below command.

yum -y install docker-io

after isntallation , we need to start docker services

#systemctl start docker
#systemctl enable docker

Now docker is running on machine and we can do docker stuff like search docker images from docker hub

#docker search centos

Install Docker on Ubuntu

To install Docker on ubuntu machines, to install docker from docker official docker repository in below way.

Add GPG key on ubuntu machine.

root@srvU:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK

Add docker repository to APT sources and update package database

root@srvU:~# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update

we need to make sure that docker packages install from docker repository

root@srvU:~# apt-cache policy docker-ce
docker-ce:
  Installed: (none)
  Candidate: 17.03.1~ce-0~ubuntu-trusty
  Version table:
     17.03.1~ce-0~ubuntu-trusty 0
        500 https://download.docker.com/linux/ubuntu/ trusty/stable amd64 Packages
     17.03.0~ce-0~ubuntu-trusty 0
        500 https://download.docker.com/linux/ubuntu/ trusty/stable amd64 Packages

Further we can install Docker on Ubuntu machine

root@srvU:~# apt-get install -y docker-ce

We should check docker services is running or not

root@srvU:~# /etc/init.d/docker start
start: Job is already running: docker

Now docker is running on machine and we can do docker stuff like search docker images from docker hub

# docker search ubuntu