top of page

Why Docker ??

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.

In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.

So lets begin with installation of Docker on Centos

Installation Of Docker

[root@tecgeek ~]# yum install docker

After installation start the Docker service

[root@tecgeek ~]# systemctl start docker

Enable Docker service to be start during server reboot

[root@tecgeek ~]# systemctl enable docker

Download Docker Images From Docker Hub

Docker Hub is a cloud-based repository in which Docker users and partners create, test, store and distribute container images. Through Docker Hub, a user can access public, open source image repositories, as well as use a space to create their own private repositories, automated build functions, webhooks and work groups.

In free subscription you can create single private repository and single parallel build.

For more plan visit @

So l have singed up for free subscription to pull images from docker hub.

If you try pull any image from docker hub without signing in then you may get below error of un-authorisation

[root@tecgeek ~]# docker pull centos Using default tag: latest Trying to pull repository ... Get unauthorized: incorrect username or password

[root@tecgeek ~]#


pull : Pull an image or a repository from a registry

centos : Name of Image to search in repository

Lets try to sign in into docker hub and see what difference it makes

[root@tecgeek ~]# docker login --username=siddheshtechtalk


Login Succeeded

[root@tecgeek ~]#


--username : supplies username for authentication under repository

siddheshtechtalk : is username of docker hub

[root@tecgeek ~]# docker pull centos

Using default tag: latest

Trying to pull repository ...

latest: Pulling from

8ba884070f61: Pull complete

Digest: sha256:a799dd8a2ded4a83484bbae769d97655392b3f86533ceb7dd96bbac929809f3c

Status: Downloaded newer image for

[root@tecgeek ~]#

Similarly you can run hello-world image which is only built for testing your integrity with Docker Hub

[root@tecgeek ~]# 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:

For more examples and ideas, visit:

[root@tecgeek ~]#

So now we have successfully downloaded centos docker image from hub and test integretiry by running hello-world test image.

To see downloaded imaged on local system run below command

[root@tecgeek ~]# docker images

REPOSITORY TAG IMAGE ID CREATED SIZE latest 9f38484d220f 4 months ago 202 MB latest 4ab4c602aa5e 10 months ago 1.84 kB

[root@tecgeek ~]#

Here : Image/size details which we downloaded from Docker Hub : Test image which we ran to verify Docker Setup

Search For Available Images On Docker Hub

[root@tecgeek ~]# docker search centos

INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED The official build of CentOS. 5461 [OK] Ansible on Centos7 122 [OK] CentOS-6 6.10 x86_64 / CentOS-7 7.6.1810 x... 110 [OK] Centos container with "headless" VNC sessi... 93 [OK] MySQL 5.7 SQL database server 59 centos6-lnmp-php56 57 [OK] Simple CentOS docker image with SSH access 44 PostgreSQL is an advanced Object-Relationa... 38 CentOS with SSH 28 [OK] CentOS image for GPDB development. Tag nam... 10 Latest CentOS image with the JRE pre-insta... 8 [OK] centos ruby 6 [OK] Base Centos Image -- Updated hourly 3 [OK] Oracle Java 8 Docker image based on Centos 7 3 [OK] Base centos, freshened up a little with a ... 3 CentOS6 日本語環境 2 [OK] CentOS with a toolchain, but unaffiliated ... 2 Using the mingw toolchain to cross-compile... 2 CentOS Base Image! Built and Updates Daily! 1 [OK] Vanilla CentOS 7 with Oracle Java Developm... 1 [OK] centos base image 1 [OK] based off of ryanj/centos7-s2i-nodejs. Bi... 0 CentosOS 6.8 image for GPDB development 0 CentosOS 7 image for GPDB development 0 centos with smartentry 0 [OK]

[root@tecgeek ~]#

Please Visit Docker Reference Guide For More Details...

Run Docker Container

Lets try to run our first container Centos which we downloaded from Docker Hub

[root@tecgeek ~]# docker run -it centos

[root@b0d031a98f7b /]# cat etc/hostname

b0d031a98f7b [root@b0d031a98f7b /]# exit

[root@tecgeek ~]#


docker run : Run a command in a new container

-it : give interactive shell access into container

b0d031a98f7b : container id of image, which gets set as a hostname.



Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page