Terminology :
This time Docker is very hot technology and most of the companies and businesses are adopting and moving application to this application containers technology because it’s features of multiple apps on same server , easy to handle and application can be shipped easily .
Here in this article we will discuss about Linux Containers and Docker technology and also installation method available on CentOs , RHEL and Fedora. Now I am going to try to explain about terminology used and installation in Linux box .
About Docker :
This is a software or tool that manage containers , create and controlling them . It creates an image or snapshot and move the server applications or api from VPS or VM’s to Linux Containers . The image contains an application and its dependencies. Now container can be started . images can be portable , save and exported to other system .
Linux Containers :
A Linux container is a lightweight application programme that permits to the kernel to run bundles of process in their own particlular confined client spaces, seprate from the host system. It have own list of process like file system, network and other daemon process. The three feature implement on linux container that is namespaces for isolation , control groups for resources control and selinux security.
Images :
A Docker images is a snapshot of linux container configuration which used to launch a container. The image having read only layer that can not be modified and its adds a read write overlay to which all changes are made.
Here we are going to install and configure docker on latest versoin of CentOS , RHEL and Fedora version , below are the details of OS and kernel requirement for runs the docker.
Recently 1.8.2 and 1.8.3 version has been released they fix a some bugs with incorrect network namespace issue.
Registry :
The registry highly scalable application and stateless that can pull and push images as a tar archive and can be loaded manually they will be pulled from registry.Images can be pushed and pulled by other machines in the network.
Installation
Installation Prerequisites :
Support OS Version : CentOS 7 , RHEL 7 , Fedora 21 and Fedora 22
Kernel Version : Kernel should be minimum 3.10 and architecture should be 64-bit
To check the current version of kernel you are running on Linux Operation System , Run below command.
# uname -r
Output should be like below like 3.10 .
3.10.0-229.14.1.el7.x86_64
Installation of Docker on CentOS 7 , RHEL 7, Fedora 21 , 22
Here we have two type of installation of Engine thorugh YUM Repository or Curl Script which will run and install required package, but before installation your system packages should be updated.Below command is for package updated on your system or server.
Here we are assuming you have root privileges , if your user have sudo privileges then you will add sudo before executing any command.
# yum update
Docker Install thorugh curl script
Run the below command for curl script installation.
#curl -sSL https://get.docker.com/ | sh
After install through curl script follow point Number (5) from below you YUM Repository Installation Method .
Create Docker YUM Repository for CentOS 7 , RHEL 7, Fedora 21, 22
(1) Create a repo file . Here i am creating repo file “dockerengine” through vim editor.
# vim /etc/yum.repos.d/engine.repo
(2) For CentOs 7 and RHEL 7 :
[techtransit] name=techtransit
Here we are giving baseurl infomation of every version of OS .You can choose one of them and insert one which will appropriate for you .
For CentOS 7 / RHEL 7 :
baseurl=https://yum.dockerproject.org/repo/main/centos/7
For Fedora 21 :
baseurl=https://yum.dockerproject.org/repo/main/fedora/21
For Fedora 22 :
baseurl=https://yum.dockerproject.org/repo/main/fedora/22
Now insert below line on repository.
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
(3) Save and Quit from vim editor.
:wq
(4) Install the package through this repository.
# yum install docker-engine
Loaded plugins: fastestmirror
dockerrepo | 2.9 kB 00:00
dockerrepo/primary_db | 5.4 kB 00:00
Loading mirror speeds from cached hostfile
* base: mirror.netdepot.com
* extras: mirror.cogentco.com
* updates: mirrors.mit.edu
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.8.3-1.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-engine x86_64 1.8.3-1.el7.centos dockerrepo 6.2 M
Transaction Summary
================================================================================
Install 1 Package
Total download size: 6.2 M
Installed size: 27 M
Is this ok [y/d/N]:y
Press y for installation . Here latest docker package version 1.8.3 showing .Here we go. After Press y then it will ask for gpg key confirmation and Press y for verify it.
Downloading packages: warning: /var/cache/yum/x86_64/7/dockerrepo/packages/docker-engine-1.8.3-1.el7.c entos.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY Public key for docker-engine-1.8.3-1.el7.centos.x86_64.rpm is not installed docker-engine-1.8.3-1.el7.centos.x86_64.rpm | 6.2 MB 00:00 Retrieving key from https://yum.dockerproject.org/gpg Importing GPG key 0x2C52609D: Userid : "Docker Release Tool (releasedocker) <[email protected]>" Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d From : https://yum.dockerproject.org/gpg Is this ok [y/N]: y
(5) Now Docker has been install and here we are starting the daemon of docker and make sure it will enable for after boot the system.Run below command.
# systemctl start docker # systemctl enable docker
You can check the below status of docker service through run the below command.
# systemctl status docker
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
Active: active (running) since Sat 2015-10-17 01:18:47 UTC; 37s ago
Docs: https://docs.docker.com
Main PID: 23938 (docker)
CGroup: /system.slice/docker.service
└─23938 /usr/bin/docker daemon -H fd://
.....
Now you can verify after checking service status , you can verify through docker container base image like centos etc. put the below command and run it.
#docker run hello-world
OUTPUT :
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b901d36b6f2f: Pull complete 0a6ba66e537a: Pull complete Digest: sha256:517f03be3f8169d84711c9ffb2b3235a4d27c1eb4ad147f6248c8040adb93113 Status: Downloaded newer image for hello-world:latest
Docker search the centos image in local file system but when it not get then it starts to download the centos image from docker registry. Here i have put some output of the above command . in full output docker decscibe how they work on this message print.
Here in our next post we are going to allow non root users in docker group to run docker containers.
That’s All!, Thanks ..
Related Articles :
Update EPEL and RepoForge Repository
Create Docker group and allow Non root user access
Reference URL :
https://docs.docker.com/