Tuesday, November 27, 2018

Docker Quick-Start

                             
 DOCKER QUICK-START 


What is DOCKER ?

Docker is the latest buzz in the IT world & people really need to know this . Lets start then : 
Docker is a containerization platform which packages an application & all its dependencies into a container. 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. Create self-contained development environments inside Docker containers. So, we share an environment already configured. The principal is “Build once deploy anywhere “
Activating this container results in the application being active.
This container we are talking about is light-weight, easily deployable, and transportable.

But why the madness behind Docker?

Because implementing any application in the traditional way using a VM is a pain. Why is it a pain?
Because each of these VMs:
·       Consume a lot of memory resources from the host
·       Are slow and take a lot of time to boot
·       Block even unused resource from the host
·       Increase the architecture complexity, as the no of VMs increase

Why Docker

·       It’s a simple and intuitive tool.
·       It enables you to spend less time on configuration and more time on building software.
·      It will allow you to build up independent containers that will interact with each other seamlessly with accuracy and speed.
·       It is a fast and consistent way to accelerate and automate the shipping of software.
·       It saves developers from having to set up and configure multiple development environments each time they test or deploy

Virtual Machines Vs Container 

We can clearly see why docker is a clear winner 


 Virtual Machines


Virtualization is the technique of importing a Guest operating system on top of a Host operating system. This technique was a revelation at the beginning because it allowed developers to run multiple operating systems in different virtual machines all running on the same host. This eliminated the need for extra hardware resource. The advantages of Virtual Machines or Virtualization are:
·       Multiple operating systems can run on the same machine
·       Maintenance and Recovery were easy in case of failure conditions
·       Total cost of ownership was also less due to the reduced need for infrastructure

Virtualization also has some shortcomings. Running multiple Virtual Machines in the same host operating system leads to performance degradation. This is because of the guest OS running on top of the host OS, which will have its own kernel and set of libraries and dependencies. This takes up a large chunk of system resources, i.e. hard disk, processor and especially RAM. 
Another problem with Virtual Machines which uses virtualization is that it takes almost a minute to boot-up. This is very critical in case of real-time applications.
Following are the disadvantages of Virtualization:
·       Running multiple Virtual Machines leads to unstable performance
·       Hypervisors are not as efficient as the host operating system
·       Boot up process is long and takes time



Containers

Containerization is the technique of bringing virtualization to the operating system level. While Virtualization brings abstraction to the hardware, Containerization brings abstraction to the operating system. Do note that Containerization is also a type of Virtualization. Containerization is however more efficient because there is no guest OS here and utilizes a host’s operating system, share relevant libraries & resources as and when needed unlike virtual machines. Application specific binaries and libraries of containers run on the host kernel, which makes processing and execution very fast. Even booting-up a container takes only a fraction of a second. Because all the containers share, host operating system and holds only the application related binaries & libraries. They are lightweight and faster than Virtual Machines.
Advantages of Containerization over Virtualization:
  • Containers on the same OS kernel are lighter and smaller
  • Better resource utilization compared to VMs
  • Boot-up process is short and takes few seconds
  • They are faster and lighter to ship as they house the minimum requirements to run your application
  • They can be versioned, shared, and archived
  • They are instantly started as they carry a much smaller blueprint than Virtual Machines
  • Build configurations are managed with declarative code
  • They can be built and extended on top of pre-existing containers





Docker Architecture


The basic architecture of Docker consists of 3 major parts:
  1.  Docker Host
  2.  Docker Client
  3.  Registry


Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of the building, running, and distributing your Docker containers.
The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.


The Docker Host

Docker Host runs the Docker Daemon. Docker Daemon listens for Docker requests.
Docker requests could be ‘docker run’, ‘docker build’, anything.
It manages docker objects such as images, containers, networks, and volumes.

The Docker Client

 Docker Client is used to trigger Docker commands. When we send any command (docker build, docker run, etc) the docker client ends these commands to Docker daemon which further will deal with them.
Note: The Docker client can communicate with more than one daemon.

Docker Registries 

The Registry is a stateless, highly scalable server-side application that stores and lets you distribute Docker images. You can create your own image or you can use public registries namely, Docker Hub and Docker Cloud. Docker is configured to look for images on Docker Hub by default.

We can create our own registry in fact.So, when we run the command docker pull or docker run, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your configured registry.

Top 100 docker interview questions

T op 100 Docker Interview Questions       The questions are divided into 6 domains as listed below : Installation and Configuratio...