Docker

  • Docker is an open platform for developing, shipping, and running applications.
    • Makes Easy –> deploy, replicate, move
  • Docker provides the ability to package and run an application in a loosely isolated environment
  • Docker is an open-source project based on Linux containers.
  • It uses Linux Kernel features like namespaces and control groups to create containers on top of an operating system.
    • Namespaces –> deal with resource isolation for a single process,
    • Cgroups –> manage resources for a group of processes.
  • Together, cgroups and namespaces were used to create a container technology called Linux Containers(LXC)
  • Light-weight version of VM
  • Runtime is less, Don’t need to boot os
|--Host(OS)
	|--Docker Engine	
		|--Container
		|--Container

Problem statement

  • It works in my machine
  • Soln –> Isolation
    • Physical
    • Virtual Machine
    • Container

Physical Machine

  • Requirement
    • One physical machine
  • Runs
    • One OS, One APP
  • Problems
    • Huge Cost
    • Slow Deployment
    • Hard to Migrate
|-- Hardware
|-- Operating System
|-- Runtime Environment
|-- Application

Virtual Machine(VM)

  • Hypervisor-based Virtualization
    • Traditinal methods of virtualization
    • Eg: VMware, Virtual Box, AWS, Azure
  • VM are bulky—typically gigabytes in size.
    • On top we install OS
    • It’s resource hungry
  • Requirement
    • One physical machine
  • Runs
    • One/more OS and APP in different VM
  • Benefits:
    • Cost-Efficient
    • Easy to Scale
  • Limitations:
    • Kernel Resource Duplication
      • RAM , Memory wastage
    • Application Portability Issue
Hardware
  |--HOST OS
	  |--VM
	  |	|--Guest OS
	  |	    |--Runtime Environment
	  |		    |--Application
	  |		
	  |--VM
	  |	|--Guest OS
		    |--Runtime Environment
			    |--Application

Container

  • Requirement
    • One physical machine
  • Runs
    • One OS
    • One or more Apps in different containers
  • Benefits:
    • Cost-Efficient
    • Fast Deployment
    • Guaranteed Portability
Hardware
  |--Host OS
	  |--Runtime Environment
	  |	  |--Application
	  |	
	  |--Runtime Environment
		  |--Application

Docker Feature

  • Sometimes application that runs in 1 platform but fail in Other
    • This does not happens with docker
  1. Ease of use
    • To take advantage of containers in order to quickly build and test portable applications.
    • The mantra is: build once, run anywhere
  2. Speed
    • Docker containers are very lightweight and fast
  3. Docker Hub
    • Docker Hub, which you can think of as an “app store for Docker images.”
  4. Modularity and Scalability
    • Docker makes it easy to break out your application’s functionality into individual containers.
  5. Portability
  6. Isolation

When use VM?

  • If you need to run multiple applications on multiple servers,
  • it probably makes sense to use VMs.

When use Docker?

  • If you need to run many copies of a single application then docker offers some compelling advantages.
  • Security has also been an area of concern with Docker containers since containers share the same kernel, the barrier between containers is thinner.

NOTE:

  1. Why Using Official Images
    • Clear Documentation
    • Dedicated Team for Reviewing Image Content
    • Security Update in a Timely Manner

Reference