Skip to Content
Author's profile photo Guruprasad GR

Docker- Part 1

        

” Any body can make things bigger or more complex. But it takes a touch of genius —  and a lot of courage to move in the opposite direction. It is always the Simple things  that produces the marvelous. “

When I think of Docker, the lines quoted above are the one’s, which flashes in my mind immediately.

We cannot regret the fact that, Mobile devices have become a Part of Our Lives. Mobile apps can be used, from Tracking our Heart Rate to Pay our Home Loans through Mobile Banking.

Surely it can be called as a Gem of an Invention. The mobile manufacturers have tried their best to include many complicated apps into the device and made it to be accessed in a simple manner. And they have achieved it too.

 

In the same way, though Docker might contain, applications or softwares of some xxxxx GB’s, still Docker remains easy to use application by itself.

To understand docker in a simple way,

Docker can be compared with a normal Read and Write Discs..

Ie, Consider this use case:

You need to download or install a software to your laptop.

Case 1:

Steps you would perform:

  1. Download it from the Official site.
  2. Or you might buy a copyrighted Disc of it.

Downloading might take more time and make your wallet looks thin.


Case 2:

 

But installing through a disc, will take minimal time. The time difference between, installing through a CD and downloading will be quite huge. Obviously, the better choice would be installing through the disc.

The functionality of Docker is also quite similar to CASE 2.

Benefits of Docker:

  • Users can take their own configuration, put it into code and deploy it.
  • It creates container for every process and does not boot an OS.
  • Data can be created and destroyed without worry that the cost to bring it up again would be affordable.
  • As docker can be used in a wide variety of environments, the requirements of the infrastructure are no longer linked with the environment of the application.

Docker container, contains all the dependencies of a software to be executed.

In this blog, I planned to discuss about,

  1. Docker’s Overview.
  2. Docker installation.
  3. Basic Commands used in Docker.

 

Overview on Docker

 

 

So, as per the formal definition,

“Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment. “

 

 

Docker Installation On a Ubuntu Machine

Prerequisites

Enter “ sudo su “ to change it to Root user.

Enter “ apt-get update “ for updating the available packages.

 

Install Docker

wget -qO- https://get.docker.com/ | sh

sudo usermod -aG docker $(whoami)

 

Basic Commands in Docker

Info:

Exa: docker info

This command gets executed successfully, only if Docker is been properly installed on the system.

 

pull : [ This command pulls a pre-built image ]

exa: docker pull sample  { where “sample” is the image name }

 

logs :  [ Log command to view the current state of the job ]

exa: docker logs test1 { where “test1” is the container name }

 

stop: [ Stops the running container ]

exa: docker stop test1 { where “ test1 “ is the container name }

 

restart: [ Restarts the container ]

exa: docker restart test1 { “test1” is the container name }

 

To remove a container, it needs to be stopped first and then removed.

Exa: docker stop test1

docker rm test1 { this command removes the container }

 

commit: [ save the container state as an image]

exa: docker commit test1 test2

the image name takes character [ a-z ] and numbers [ 0-9]

 

images: [ Lists, all the images present]

exa: docker images

 

docker ps –a : Displays all the created container on that  instance.


Conclustion:

Have tried to explain Docker in a simpler way, with an overview and basic commands of it.

 

This is the end of Part-1 of my Blog.

And Part-2 will be of Cassandra and the cluster creation of it.

 

Thanks for reading the Blog.

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.