www.unicomlearning.com
Emerging TechnologyEmerging Technology
Summit 2014Summit 2014
www.cloudandmobility.org
26 Sept, 2014 - Bangalore26 Sept, 2014 - Bangalore
DockerDocker
Suresh BallaSuresh Balla
Principal ConsultantPrincipal Consultant
Neudesic, IndiaNeudesic, India
www.unicomlearning.com
Agenda
UNICOM PresentsUNICOM Presents
Emerging TechnologyEmerging Technology
Summit-2014Summit-2014
What?
Why?
How?
Ecosystem?
What is a Docker?
Build, Ship and Run Any App, Anywhere
Lightweight Virtualized Environments
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 Challenge
Multiplicityof
Stacks
Multiplicityof
hardware
environments
Production Cluster
Customer Data Center
Doservicesand
appsinteract
appropriately?
CanImigrate
smoothlyand
quickly?
Slide Reference: DockerCon
Static website Web frontendUser DB Queue Analytics DB
Development
VM
QA server Public Cloud Contributor’s
laptop
Docker containers to rescue
MultiplicityofStacks
Multiplicityof
hardware
environments
Production
Cluster
Customer Data
Center
Doservicesand
appsinteract
appropriately?
CanImigrate
smoothlyand
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
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
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
Docker Workflow
Source Code
Repository
Dockerfil
e
For
A
Docker Engine
Docker
Container
Image
Registry
Build
Docker
Host 2 OS (Linux)
ContainerA
ContainerB
ContainerC
ContainerA
Push
Search Pull
Run
Host 1 OS (Linux)
Slide Reference: DockerCon
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
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
Docker CLI
• docker search
• docker pull
• docker run
• docker commit
• docker inspect
• docker push
• docker images
Demo
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
Technologies
• Go Lang
• Open Sourced by DotCloud March
2013
• Libcontainer - cgroups, namespaces
– LXC as default environments in
versions < 0.9
Authoring Images with Dockerfile# DOCKER-VERSION 0.10.0
# Pull base image.
FROM ubuntu:14.04
# Install Node.js
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get install -y nodejs
RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
ADD . /src
# add the supervisor config file to default location that it would look for
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN cd /src; npm install
ENV PORT 3001
ENV NODE_ENV development
EXPOSE 3001
CMD ["node", "/src/server.js"]
Demo
One Process per Container
Only one process per container
Use supervisor process to launch multiple child process inside
the container
Docker Hub
• SaaS offerings - Public and private repositories
• Need your own private registry?
– https://github.com/docker/docker-registry
– Also a Docker container
Automated Builds
GitHub and BitBucket Integrations
Web Hooks
Build Triggers
Demo
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
Related Open Source Libraries
Go lang based
•libcontainer
•libchan
•libswarm
Use Cases
• Cloud9 IDE
• eBay
• mailGun/Rackspace
• CloudFlare
• Cambridge Health Care
• Red Hat Openshift
www.unicomlearning.com
Emerging TechnologyEmerging Technology
Summit-2014Summit-2014
Organized byOrganized by
UNICOM Trainings & Seminars Pvt. Ltd.UNICOM Trainings & Seminars Pvt. Ltd.
contact@unicomlearning.comcontact@unicomlearning.com
Suresh BallaSuresh Balla
Suresh.Balla@Neudesic.comSuresh.Balla@Neudesic.com
www.cloudandmobility.org

Docker, a new LINUX container technology based light weight virtualization

  • 1.
    www.unicomlearning.com Emerging TechnologyEmerging Technology Summit2014Summit 2014 www.cloudandmobility.org 26 Sept, 2014 - Bangalore26 Sept, 2014 - Bangalore DockerDocker Suresh BallaSuresh Balla Principal ConsultantPrincipal Consultant Neudesic, IndiaNeudesic, India
  • 2.
    www.unicomlearning.com Agenda UNICOM PresentsUNICOM Presents EmergingTechnologyEmerging Technology Summit-2014Summit-2014 What? Why? How? Ecosystem?
  • 3.
    What is aDocker? Build, Ship and Run Any App, Anywhere Lightweight Virtualized Environments
  • 4.
    Static website Web frontend UserDB 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 Challenge Multiplicityof Stacks Multiplicityof hardware environments Production Cluster Customer Data Center Doservicesand appsinteract appropriately? CanImigrate smoothlyand quickly? Slide Reference: DockerCon
  • 5.
    Static website WebfrontendUser DB Queue Analytics DB Development VM QA server Public Cloud Contributor’s laptop Docker containers to rescue MultiplicityofStacks Multiplicityof hardware environments Production Cluster Customer Data Center Doservicesand appsinteract appropriately? CanImigrate smoothlyand 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
  • 6.
    VMs vs BareContainers 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
  • 7.
    VMs vs BareContainers 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
  • 8.
    Docker Workflow Source Code Repository Dockerfil e For A DockerEngine Docker Container Image Registry Build Docker Host 2 OS (Linux) ContainerA ContainerB ContainerC ContainerA Push Search Pull Run Host 1 OS (Linux) Slide Reference: DockerCon
  • 9.
    Docker Architecture • ClientServer Architecture – Sockets or RESTfull API • Docker Deamon • Docker client • Images – a read-only templates • Registries - holds images • Container – created from an image
  • 10.
    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
  • 11.
    Docker CLI • dockersearch • docker pull • docker run • docker commit • docker inspect • docker push • docker images
  • 12.
  • 13.
    Setup • On yourservers (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
  • 14.
    Technologies • Go Lang •Open Sourced by DotCloud March 2013 • Libcontainer - cgroups, namespaces – LXC as default environments in versions < 0.9
  • 15.
    Authoring Images withDockerfile# DOCKER-VERSION 0.10.0 # Pull base image. FROM ubuntu:14.04 # Install Node.js RUN apt-get update RUN apt-get install -y software-properties-common RUN add-apt-repository -y ppa:chris-lea/node.js RUN apt-get update RUN apt-get install -y nodejs RUN apt-get install -y supervisor RUN mkdir -p /var/log/supervisor ADD . /src # add the supervisor config file to default location that it would look for ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf RUN cd /src; npm install ENV PORT 3001 ENV NODE_ENV development EXPOSE 3001 CMD ["node", "/src/server.js"]
  • 16.
  • 17.
    One Process perContainer Only one process per container Use supervisor process to launch multiple child process inside the container
  • 18.
    Docker Hub • SaaSofferings - Public and private repositories • Need your own private registry? – https://github.com/docker/docker-registry – Also a Docker container
  • 19.
    Automated Builds GitHub andBitBucket Integrations Web Hooks Build Triggers
  • 20.
  • 21.
    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
  • 22.
    Related Open SourceLibraries Go lang based •libcontainer •libchan •libswarm
  • 23.
    Use Cases • Cloud9IDE • eBay • mailGun/Rackspace • CloudFlare • Cambridge Health Care • Red Hat Openshift
  • 24.
    www.unicomlearning.com Emerging TechnologyEmerging Technology Summit-2014Summit-2014 OrganizedbyOrganized by UNICOM Trainings & Seminars Pvt. Ltd.UNICOM Trainings & Seminars Pvt. Ltd. contact@unicomlearning.comcontact@unicomlearning.com Suresh BallaSuresh Balla Suresh.Balla@Neudesic.comSuresh.Balla@Neudesic.com www.cloudandmobility.org