Tuesday 21 April 2020

Docker Part 0.1 (Source stackoverflow n docker.com)

Docker

There are three different setups that providing a stack to run an application on (This will help us to recognize what a container is and what makes it so much powerful than other solutions):
1) Traditional Servers(bare metal)
2) Virtual machines (VMs)
3) Containers
 
1) Traditional server stack consist of a physical server that runs an operating system and your application.
Advantages:
  • Utilization of raw resources
  • Isolation
Disadvantages:
  • Very slow deployment time
  • Expensive
  • Wasted resources
  • Difficult to scale
  • Difficult to migrate
  • Complex configuration
2) The VM stack consist of a physical server which runs an operating system and a hypervisor that manages your virtual machine, shared resources, and networking interface. Each Vm runs a Guest Operating System, an application or set of applications.
Advantages:
  • Good use of resources
  • Easy to scale
  • Easy to backup and migrate
  • Cost efficiency
  • Flexibility
Disadvantages:
  • Resource allocation is problematic
  • Vendor lockin
  • Complex configuration
3) The Container Setup, the key difference with other stack is container-based virtualization uses the kernel of the host OS to rum multiple isolated guest instances. These guest instances are called as containers. The host can be either a physical server or VM.
Advantages:
  • Isolation
  • Lightweight
  • Resource effective
  • Easy to migrate
  • Security
  • Low overhead
  • Mirror production and development environment
Disadvantages:
  • Same Architecture
  • Resource heavy apps
  • Networking and security issues.
- A platform  for (a)developing,(b)shipping & (c)running application
- Container based over virtualization technology
- Container management service Since March 2013
- Especially for AGILE methodology both development and testing activities are concurrent

Docker encapsulates an application with all its dependencies.

Adv:
Ability to reduce size.
Seamlessly working across different platforms.
Deploy container any where physical machine virtual machine and even in cloud platform  
scalable light weight



1. Lightweight

This is probably the first impression for many docker learners.
First, docker images are usually smaller than VM images, makes it easy to build, copy, share.
Second, Docker containers can start in several milliseconds, while VM starts in seconds.

2. Layered File System

This is another key feature of Docker. Images have layers, and different images can share layers, make it even more space-saving and faster to build.
If all containers use Ubuntu as their base images, not every image has its own file system, but share the same underline ubuntu files, and only differs in their own application data.

3. Shared OS Kernel

Think of containers as processes!
All containers running on a host is indeed a bunch of processes with different file systems. They share the same OS kernel, only encapsulates system library and dependencies.
This is good for most cases(no extra OS kernel maintains) but can be a problem if strict isolations are necessary between containers.



Docker, basically containers, supports OS virtualization i.e. your application feels that it has a complete instance of an OS whereas VM supports hardware virtualization. You feel like it is a physical machine in which you can boot any OS.