Friday, April 29, 2016

Learning "DOCKER"



Learning "DOCKER"


1) Docker is an open source project that automates the deployment of applications inside Linux
    Containers, and provides the capability to package an application with its run time dependencies
    into a container.
2) It provides a Docker CLI command line tool for the life cycle management of
     image-based containers.
3) Containers are disposable / fast/ ephemeral / Immutable.
4) Compared to VM, Docker Containers starts in seconds.
5) Docker Containers are portable across machines. We just need Docker Engine on any machine to
    run any number of docker containers from images.
6) Docker Containers include minimal run time requirements of the application, reducing their size
    and allowing them to be deployed quickly.
7) Sharing containers with others by keeping them in remote repositories.
8) Lightweight Footprint and Minimal Overhead - Images are typically very small, facilitates rapid
    delivery and reduces time to deploy new application containers.
 9)Containers isolate apps from each other and the underlying infrastructure while providing
     an added layer for protection.
10) Being sharing the same OS Kernel - containers start immediately compared to VM's.
so docker is called as light weight VM.
11) Docker Containers run on all major Linux Distributions and Microsoft OS's with support for
      every infrastructure.
12) Containers eliminate Environment Inconsistencies by packaging the application with its configs
      and dependencies together and shipping as a containers, the application will always work as  
      designed locally, on another machine, in test or production. No more worries about having to
      install the same configs into a different environment.

Components in "DOCKER"
Docker works with the following fundamental components:

Container
Each container is based on an image that holds necessary configuration data. When you launch a container from an image, a writable layer is added on top of this image. Every time you commit a container (using the docker commit command), a new image layer is added to store your changes.
Docker allows you to package an application with all of its dependencies into a standardized unit(Container) for software development.
Image
       A Docker image is made up of filesystems layered over each other.
At the base if boot filesystem(bootfs) - resembles Linux/ Unix boot file system.
Docker user will never interact wil bootfs.
when a container is booted, it's moved to memory, and the bootfs in unmounted to free up the             RAM used by the initrd disk image.
A static snapshot of the containers' configuration. Image is a read-only layer that is never modified, all changes are made in top-most writable layer, and can be saved only by creating a new image. Each image depends on one or more parent images.

Platform Image
An image that has no parent. Platform images define the runtime environment, packages and utilities necessary for containerized application to run. The platform image is read-only, so any changes are reflected in the copied images stacked on top of it. See an example of such stacking in the below Figure

Registry 
A repository of images. Registries are public or private repositories that contain images available for download.Some registries allow users to upload images to make them available to others.

Dockerfile
A configuration file with build instructions for Docker images. Dockerfiles provide a way to automate, reuse, and share build procedures.

More Information about Containers:
       Linux Containers using core technologies such as
Control Groups (Cgroups) for Resource Management
Namespaces for Process Isolation




LINUX CONTAINERS ARCHITECTURE
Several components are needed for Linux Containers to function correctly,
most of them are provided by the Linux kernel. Kernel namespaces ensure process isolation
and cgroups are employed to control the system resources. SELinux is used to assure separation
between the host and the container and also between the individual containers. Management
interface  forms a higher layer that interacts with the aforementioned kernel components and  
provides tools for  construction and management of containers.

DOCKER Commands:
docker info
docker -v                               = Provides Docker Version
docker images
docker images --no-trunc     =true
docker ps                           = Lists only running containers
docker ps -a                       = Lists all containers(Including stopped containers)
docker pull imagename        = Pulls docker image from the Central Docker Hub Registry.
docker run imagename         = Spins up(start) a Container.
docker run -i -t ubuntu bash = Spins up ubuntu container and executes bash command - If you
                                                  run this command "n" times, "n" containers will spin up.
docker kill containername | ID
docker stop containername | ID
docker rm containername  | ID or Delete/ Remove the Container

Virtual Machine Vs DOCKER


Docker Architecture




Docker Interactions




Advantages of "DOCKER"
More Info to be Added Soon

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.