Top Banner
www.unicomlearning.com Emerging Technology Emerging Technology Summit 2014 Summit 2014 www.cloudandmobility.org 26 Sept, 2014 - Bangalore 26 Sept, 2014 - Bangalore Docker Docker Suresh Balla Suresh Balla Principal Consultant Principal Consultant Neudesic, India Neudesic, India
24

Docker, a new LINUX container technology based light weight virtualization

May 26, 2015

Download

Suresh Balla

An Intro to Docker
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker, a new LINUX container technology based light weight virtualization

www.unicomlearning.com

Emerging Technology Emerging Technology Summit 2014Summit 2014

www.cloudandmobility.org

26 Sept, 2014 - Bangalore26 Sept, 2014 - Bangalore

DockerDocker

Suresh BallaSuresh Balla

Principal ConsultantPrincipal Consultant

Neudesic, IndiaNeudesic, India

Page 2: Docker, a new LINUX container technology based light weight virtualization

www.unicomlearning.comAgenda

UNICOM PresentsUNICOM Presents

Emerging Technology Emerging Technology Summit-2014Summit-2014

What?Why?How?Ecosystem?

Page 3: Docker, a new LINUX container technology based light weight virtualization

What is a Docker?

Build, Ship and Run Any App, Anywhere

Lightweight Virtualized Environments

Page 4: Docker, a new LINUX container technology based light weight virtualization

Static website

Web frontend

User DB

Queue Analytics DB

Background workers

API endpoint

nginx 1.5 + modsecurity + openssl + bootstrap 2

postgresql + pgv8 + v8

hadoop + hive + thrift + OpenJDK

Ruby + Rails + sass + Unicorn

Redis + redis-sentinel

Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs + phantomjs

Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client

Development VM

QA server

Public Cloud

Disaster recovery

Contributor’s laptop

Production Servers

The ChallengeM

ultip

licity

of

Stac

ksM

ultip

licity

of

hard

war

e en

viro

nmen

ts Production Cluster

Customer Data Center

Do services and apps interact

appropriately?

Can I migrate

smoothly and quickly?

Slide Reference: DockerCon

Page 5: Docker, a new LINUX container technology based light weight virtualization

Static website Web frontend User DB Queue Analytics DB

Development VM

QA server Public Cloud Contributor’s laptop

Docker containers to rescue M

ultip

licity

of S

tack

sM

ultip

licity

of

hard

war

e en

viro

nmen

ts

Production Cluster

Customer Data Center

Do services and apps interact

appropriately?

Can I migrate

smoothly and quickly

…that can be manipulated using standard operations and run consistently on virtually any hardware platform

An engine that enables any payload to be encapsulated as a lightweight, portable, self-sufficient container…

Slide Reference: DockerCon

Page 6: Docker, a new LINUX container technology based light weight virtualization

VMs vs Bare Containers vs Docker

Hardware

Operating System

Type 2 Hypervisor

Virtual Machine

Operating System

Bins / libs

App App

Virtual Machine

Operating System

Bins / libs

App App

Hardware

Type 1 Hypervisor

Virtual Machine

Operating System

Bins / libs

App App

Virtual Machine

Operating System

Bins / libs

App App

Hardware

Operating System

Container

Bins / libs

App App

Container

Bins / libs

App App

Page 7: Docker, a new LINUX container technology based light weight virtualization

VMs vs Bare Containers vs Docker

Hardware

Operating System

Type 2 Hypervisor

Virtual Machine

Operating System

Bins / libs

App App

Virtual Machine

Operating System

Bins / libs

App App

Hardware

Type 1 Hypervisor

Virtual Machine

Operating System

Bins / libs

App App

Virtual Machine

Operating System

Bins / libs

App App

Hardware

Operating System

ContainerBins / libs

App App

Container

Bins / libs

App App

Page 8: Docker, a new LINUX container technology based light weight virtualization

Docker Workflow

Source Code Repository

Dockerfile

For A

Docker Engine

DockerContainer

Image Registry

Build

Docker

Host 2 OS (Linux)

Container A

Container B

Container C

Container A

Push

Search Pull

Run

Host 1 OS (Linux)

Slide Reference: DockerCon

Page 9: Docker, a new LINUX container technology based light weight virtualization

Docker Architecture• Client Server Architecture

– Sockets or RESTfull API

• Docker Deamon• Docker client• Images – a read-only

templates• Registries - holds images• Container – created from an

image

Page 10: Docker, a new LINUX container technology based light weight virtualization

sudo docker run -i -t ubuntu /bin/bash

• Pulls the ubuntu image• Creates a new container• Allocates a filesystem and mounts a read-write layer• Allocates a network / bridge interface• Sets up an IP address• Executes a process that you specify• Captures and provides application output

Page 11: Docker, a new LINUX container technology based light weight virtualization

Docker CLI• docker search• docker pull• docker run• docker commit• docker inspect• docker push• docker images

Page 12: Docker, a new LINUX container technology based light weight virtualization

Demo

Page 13: Docker, a new LINUX container technology based light weight virtualization

Setup• On your servers (LINUX)

– Packages (Ubuntu, Debian, Fedora etc.)– Single Binary install – Easy provisioning on Rackspace, Digital Ocean, AWS – EC2, GCE,

Windows Azure• On your dev environment

– Vagrant Up– Boot2docker (25 MB VM image)– Natively (If you run Linux)

Linux Kernel 3.8

Page 14: Docker, a new LINUX container technology based light weight virtualization

Technologies

• Go Lang• Open Sourced by DotCloud March

2013• Libcontainer - cgroups, namespaces

– LXC as default environments in versions < 0.9

Page 15: Docker, a new LINUX container technology based light weight virtualization

Authoring Images with Dockerfile# DOCKER-VERSION 0.10.0

# Pull base image.FROM ubuntu:14.04

# Install Node.jsRUN apt-get updateRUN apt-get install -y software-properties-commonRUN add-apt-repository -y ppa:chris-lea/node.jsRUN apt-get updateRUN apt-get install -y nodejsRUN apt-get install -y supervisorRUN mkdir -p /var/log/supervisor

ADD . /src

# add the supervisor config file to default location that it would look forADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN cd /src; npm install

ENV PORT 3001ENV NODE_ENV development

EXPOSE 3001

CMD ["node", "/src/server.js"]

Page 16: Docker, a new LINUX container technology based light weight virtualization

Demo

Page 17: Docker, a new LINUX container technology based light weight virtualization

One Process per Container

Only one process per container

Use supervisor process to launch multiple child process inside the container

Page 18: Docker, a new LINUX container technology based light weight virtualization

Docker Hub• SaaS offerings - Public and private repositories

• Need your own private registry?– https://github.com/docker/docker-registry– Also a Docker container

Page 19: Docker, a new LINUX container technology based light weight virtualization

Automated Builds

GitHub and BitBucket Integrations

Web Hooks

Build Triggers

Page 20: Docker, a new LINUX container technology based light weight virtualization

Demo

Page 21: Docker, a new LINUX container technology based light weight virtualization

Ecosystem• Cocaine, Dein, Flynn – Private PaaS• CoreOS, full distro based on Docker – Linux Distribution• Red Hat’s Project Atomic - Linux Distribution• Google’s Kubernetes – container management• New Relic Centurian – container management• OpenStack Integration (In Havana, Nova has Docker driver)• Vagrant – Docker provider

Page 22: Docker, a new LINUX container technology based light weight virtualization

Related Open Source LibrariesGo lang based•libcontainer•libchan•libswarm

Page 23: Docker, a new LINUX container technology based light weight virtualization

Use Cases• Cloud9 IDE• eBay• mailGun/Rackspace• CloudFlare• Cambridge Health Care• Red Hat Openshift

Page 24: Docker, a new LINUX container technology based light weight virtualization

www.unicomlearning.com

Emerging Technology Emerging Technology Summit-2014Summit-2014

Organized byOrganized byUNICOM Trainings & Seminars Pvt. Ltd. UNICOM Trainings & Seminars Pvt. Ltd.

[email protected]@unicomlearning.com

Suresh BallaSuresh [email protected]@Neudesic.com

www.cloudandmobility.org