Docker-Why Developers Love Docker? Just Have A Look!

Knoldus Blog Audio
Reading Time: 5 minutes
Docker

It is basically a tool which enables developers to create,deploy and to run any application easily as light-weight container ,which could run virtually anywhere.The main purpose of Docker is to easily develop applications. It further ship them into containers so that they can then be deployed anywhere. This feature is very helpful to developers. And most importantly it is an open source. This means that anyone can contribute to this and extend it to meet their own needs if they need additional features that aren’t available out of the box.

Today, Docker, and its open-source is way much bigger. Over 3.5 million applications have been placed in containers using this technology and over 37 billion containerised applications have been downloaded. Docker also refers to Docker, Inc., the company that sells the commercial version of Docker, and to the Docker open source project, to which Docker Inc. and many other organisations and individuals contribute.

Why To Use It?

Why Docker?

Docker is basically something which provides grip on a software. One can use it to wrap up his application in such a way that it can have each and everything inside it’s OS, including all the libraries and dependencies, etc ., as because it will provide containers , and then those containers will hold application in it. And then developers can transfer those containers to testing department and they will simply run those containers on their machine, without installing any kind of external libraries or dependencies or any kind of developer’s specific versions on their machine.

It is designed to benefit both developers and system administrators, making it a part of many DevOps (developers + operations) tool chains. Developers can focus on writing code without worrying about the system that it will ultimately be running on.This allows developers to get a head start by using one of thousands of programs already designed to run in a container as a part of their application

What is Docker Container?

It is the container which basically hold each and every information/file of the developers end. The application is packed inside these containers and then it can be given to tester for further testing processes and then testing department will again transfer that particular container to production team, and then production team will deploy the project as it is. So in this complete process there was no need for anyone to install any kind of dependencies or OS version or any kind of thing which may cause a hurdle for the project to run properly in any system as they simple have container to check the proper working of any application.

Container

Here at very bottom there is hardware and then that hardware will have its OS then that particular OS will be having docker inside it , and then it will provide containers, and those containers will hold applications that can be transferred to any other system without any fail.

Docker Hub!

It is a repository registry service provided by Docker Inc.

Docker Hub.

We can push or pull docker images from it. In simple words we can compare it with git hub . It is a cloud-based online repository that stores both types of repositories, i.e., pubic repository as well as the private repository. Public repositories are accessible to everyone, but the private one is accessible to the concerned owner of the repositories; also there is a cost associated with it if we store more than a certain number of repositories as a private.

Features:-

  • Image Repositories
  • Git Hub And Bit Bucket Integration.
  • Web hooks.
  • Official and publisher images.
  • Team And Organisations.

Architecture

Architecture

The Docker daemon

This listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage it’s services.

The Docker client

It is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to docker‘d, which carries them out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon.

Container

It is the container which basically hold each and every information/file of the developers end.

Image

In Docker, everything is based on Images. An image is a combination of a file system and parameters.

Volumes

In the docker-compose file, each service also has an attribute called “volumes.” Volumes are the way we can handle persistent data that’s used by containers. Different containers can access the same volumes.

Advantages

  • Ease-of-Use – These containers can always be run using one single docker run command
  • Cross-platform Installation –These Containers contain their own operating system, so they will run on any platform.
  • Mobility – Ability to Run Anywhere.
  • Simplified maintenance – It helps in reducing effort and risk of problems with application dependencies.
  • Safety – Files in a container can’t access files on the host machine, so users can trust it’s applications.
  • Flexibility– It is very much flexible.
  • Fast Deployment– It deals with fast deployment of the applications as well.

Docker vs Virtual Machine!

  • Virtual machines solve the same problem , but are much less lightweight
  • Virtual machines package the entire guest OS, while Docker uses the host kernel and a minimal OS that can be shared between containers

Installation In Linux

Installation methods

You can install Docker Engine in different ways, depending on your needs:

  1. Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.
  2. Some users download the DEB package and install it manually and manage upgrades completely manually. This is useful in situations such as installing it on air-gasped systems with no access to the internet.
  3. In testing and development environments, some users choose to use automated convenience scripts to install Docker.

Install using the repository

Before you install it for the first time on a new host machine, you need to set up the repository. Afterwards, you can install and update Docker from the repository.

SET UP THE REPOSITORY

1.Update the apt package index and install packages to allow apt to use a repository over HTTP’S:

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

2. Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88 , by searching for the last 8 characters of the fingerprint.

$ sudo apt-key fingerprint 0EBFCD88

pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

3. Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below.

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

INSTALL DOCKER ENGINE

  • Update the apt package index, and install the latest version of Docker Engine and container, or go to the next step to install a specific version: $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io
 $ sudo apt-get update
 $ sudo apt-get install docker-ce docker-ce-cli containerd.io
  • Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~ubuntu-xenial.
$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
  • Verify that Docker Engine is installed correctly by running the hello-world image.
$ sudo docker run hello-world

And That’s It. You are done with the installation!

Want To Explore More? Click Here.