Docker, Cloud Foundry, Bosh & Bluemix

36
Meetup.com/Bluemix Meetup.com/CloudFoundry Docker, Cloud Foundry & BOSH Reimagining applications runtime and packaging Animesh Singh, Ferran Rodenas, Michael Fraenkel @AnimeshSingh @Ferdy @MichaelFraenkel Apps Sponsored by Bluemix

description

Docker, Cloud Foundry & Bosh. Why use containers? How does Bluemix fit into this? What about adding services? All these questions are answered, and more!

Transcript of Docker, Cloud Foundry, Bosh & Bluemix

Page 1: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker, Cloud Foundry & BOSH!Reimagining applications runtime and packaging

Animesh Singh, Ferran Rodenas, Michael Fraenkel @AnimeshSingh @Ferdy @MichaelFraenkel

Apps Sponsored by Bluemix

Page 2: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

http://www.meetup.com/BlueMix/!

http://www.meetup.com/CloudFoundry/!

Meetup Groups:

Silicon Valley Cloud Foundry and Bluemix Meetups

Page 3: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

§  IBM initiative to develop a Platform as a Services offering !

§  IBM and partner cloud services!

§  Integrated DevOps with both Browser and Eclipse-based tools!

Services  

Lifecycle    Management  (JazzHub)  

Applica8on  Run8me  

Run8mes  &  Frameworks    

Middleware   Applica8on   Opera8onal   Mobile   External  Data  

node   java   ruby   Worklight  WebSphere  Liberty  

Web  IDE  (Eclipse  Orion)   Eclipse  IDE  

Applica8on  Composi8on  Environment  

Create  &  Manage  Services  

Test/Run   Test/Run  

Explore  Services  

Explore  Services  

IBM  Bluemix ™  Check  In  Code   Check  In  Code  

Today`s Meetup Sponsor: IBM Bluemix - Public PaaS powered by Cloud Foundry

Register today at http://bluemix.net!

Page 4: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Meetup.com/CloudFoundry Meetup.com/Bluemix !September 10th, IBM North San Jose , Room # 1066 6:30 PM!!

Sessions!§  Docker Overview and Architecture Animesh Singh!

§  Docker Service Broker to manage Stateful Docker Containers Ferran Rodenas !

§  Cloud Foundry , Diego and Docker Michael Fraenkel!

§  Questions and Answers session!!!!!

Today`s Meetup Agenda:

Docker , Cloud Foundry and BOSH Meetup

Page 5: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker - What, Why and How!Animesh Singh @animeshsingh

Architecture and Deep Dive!Source – http://docker.com!

Page 6: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

ü One of the most disruptive technologies of recent past!ü  Every significant vendor (IBM, Pivotal, OpenStack, Google, AWS, VMWare etc) has announced support for Docker!ü  First Docker conference was a huge success – with over 1000 attendees!!

What is it ? !A tool to!§  Run applications: An open source tool to run applications inside of a Linux container, a kind of light-weight

virtual machine!§  Package applications: In addition to running, it also offers tools to package containerized applications through

Docker files!§  Distribute applications: Create your own Docker registries or hubs, a cloud service for sharing applications and

automating workflows.!

What is Docker

Page 7: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Why Docker ?

Page 8: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Static website Web frontend User DB Queue Analytics DB

Development VM QA server Public Cloud Contributor’s

laptop

Mul8p

licity

 of  

Stacks  

Mul8p

licity

 of  

hardware  

environm

ents  

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…  

It is a shipping container system for code

Page 9: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

ü Developers !ü  Sysadmins!ü Operators!!

For :!§  Faster delivery of applications : Develop on local containers, share

development stack via Docker with colleagues, push code and the stack onto a test environment !!

§  Deploying and scaling more easily : Docker containers can be deployed easily on a developer's local host, on physical or virtual machines in a data center, or in the Cloud. It quickly scale up or tear down applications and services in near real time.!!

§  Achieving higher density and running more workloads: Docker is lightweight and fast. It provides a viable alternative to hypervisor-based vms - specially useful in high density environments: for example IaaS or PaaS!

Who can use Docker ?

Page 10: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

§  Docker uses a client-server architecture. !!

§  The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. !!

§  Both the Docker client and the daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. !!

§  The Docker client and daemon communicate via sockets or through a RESTful API.!

How does it work ? Architectural Overview

Page 11: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

!§  Docker images are read-only templates from which Docker

containers are launched. !!

§  Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. - reason Docker is so lightweight !

§  Every image starts from a base image, for example ubuntu, a base Ubuntu image, or fedora, a base Fedora image. Docker images are then built from these base images using a simple, descriptive set of steps we call instructions. !

§  These instructions are stored in a file called a Dockerfile. Docker reads this Dockerfile when you request a build of an image, executes the instructions, and returns a final image.!

§  Docker images are hosted on Docker hub or registry!

Docker Images, Dockerfile and Docker Registry https://registry.hub.docker.com/!!

Page 12: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

!ü  A Docker container consists of an operating system, user-added

files, and meta-data – Basically a way to run mini operating systems in your host operating system with strong guarantees of isolation !

!ü  The Docker image is read-only. When Docker runs a container

from an image, it adds a read-write layer on top of the image (using a union file system) in which your application can then run.!

!ü Underlying Technology : Written in Go and makes use of several

Linux kernel features!

§  Namespaces - pid, net, mnt, ipc, etc.!§  Control Groups - cgroups (memory, cpu, blkio, devices)!§  Union File Systems - UnionFS (AUFS, btrfs, vfs)!§  Container Format - libcontainer or LXC!

Docker Containers

Page 13: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker Hello World !

!sudo apt-get install docker.io!

sudo docker run -i -t ubuntu /bin/echo 'Hello world'!

sudo docker ps!

! sudo docker pull ubuntu!

!

!sudo docker images!

!

Page 14: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker Containers vs Virtual Machines Virtual Machines Each virtualized application includes not only the application - which may be only 10s of MB - and the necessary binaries and libraries, but also an entire guest operating system - which may weigh 10s of GB.

Docker The Docker Engine container comprises just the application and its dependencies. It runs as an isolated process in userspace on the host operating system, sharing the kernel with other containers

Compared with Hypervisors, Docker which is OS-Level Virtualization:

•  CPU Performance => native performance •  Memory Performance => few % for (optional)

accounting •  Network Performance => small overhead; can be

optimized to zero overhead •  creating a new base image takes a few seconds

(copy-on-write) •  apps in different containers can share the same

binaries / libs

Page 15: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Eclipse  IDE  

CLI  

Browser  

cf  push  

hSp  

Cloud  Controller  (API)    

Router  

DEA  Pool      DEA  Pool      Droplet  Execu8on    

Agent  (DEA)  Pool      

Health  Manager  

NATS  (Message  bus)  

Cloud Foundry Architecture

Page 16: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Eclipse  IDE  

CLI  

Browser  

Cloud  Controller  (API)    

                       S  E  R  V  I  C  E    B  R  O  K  E  R    

DEA  Pool                          Service  Backend  

Service  instance  

Service  instance  

cf  create-­‐service  

cf  bind-­‐service  

Provision Instance (PUT /v2/service

instances/:id)

Create Binding (PUT /v2/

service_instances/:id

DEA  Pool                  DEA  Pool    

 App  

App  

Service  instance  

 App  

Fetch Catalog (GET /v2/catalog

Cloud Foundry Services

Page 17: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker Service Broker for Cloud Foundry! Ferran Rodenas @ferdy Cloud Foundry Platform Engineering Team @ Pivotal

Page 18: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry Services!

Cloud Foundry Services enables application developers to provision a service on demand and bind it to an application using a really simple and agile workflow!

Page 19: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry Services Broker API!

Page 20: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry Services!

•  Where do I find services ready for Cloud Foundry?!

•  Do I need to create an specific service broker?!

•  Do I need to create a BOSH release?!

Page 21: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker Service Broker for Cloud Foundry!

An easy and convenient way to expose development and !testing services to your applications without the overhead of !creating an specific service broker by just using !Docker images!

Disclaimer: !!Everything stated in this presentation is to be considered my wife’s opinion, I have none (in my opinion). !Actual mileage may vary. !Price does not include tax, title, and license. !Some assembly required. !Each sold separately. !Batteries not included. !Objects in mirror are closer than they appear. !If conditions persist, contact a physician. !Keep out of reach of children.!Avoid prolonged exposure to direct sunlight.!Keep in a cool dark place.!

Page 22: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker Service Broker for Cloud Foundry!•  Services Catalog: predefined Docker services!

•  Provision an instance: create and start a predefined Docker container and assign random credentials via environment variables!

•  Bind an instance to an application: send service credentials hash back to the bound application!

•  Unbind an instance!

•  Unprovision an instance: destroy Docker container!

•  Expose a management dashboard: top processes, stdout/stderr logs, …!

•  Syslog drain URL: drain your application logs to a Docker syslog (logstash, …)!

Page 23: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Docker Service Broker for Cloud Foundry!

•  Deploy it on your choice of IaaS!•  Service broker application self-healing!•  VM self-healing!•  Resize persistent data without data loss!•  Drain containers logs to a remote syslog!

It can be deployed as a standalone application, as a !Docker container (frodenas/cf-containers-broker) OR!!Using the Docker BOSH Release:! https://github.com/cf-platform-eng/docker-boshrelease!

Page 24: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Services Marketplace!

Page 25: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Credentials Hash!

Page 26: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Management Dashboard!

Page 27: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Show Demo Time!

Page 28: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Wanna learn more?!!Blog Post: !http://blog.pivotal.io/cloud-foundry-pivotal/products/docker-service-broker-for-cloud-foundry!!Youtube videos:!•  Part 1: Provision services using Docker containers http://youtu.be/cxBKN_nV59g!•  Part 2: Binding applications to services http://youtu.be/AaWguQi_18g!•  Part 3: Multi-database engines tests http://youtu.be/192ogfmJPPc!•  Part 4: Draining application events and logs http://youtu.be/9hTo6Vk_cWk!!

!

Page 29: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry, Diego and Docker!Today, Tomorrow, Some Day soon!!@MichaelFraenkel

Page 30: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

!

§  Today!

§  Tomorrow – Diego!

§  Some Day soon - Docker!

Cloud Foundry – Agenda

Page 31: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry – Today & Tomorrow

§  CF Summit Keynote (Slides)!https://docs.google.com/file/d/0BzowTjPNRrlzWEJtSzJBWThLc0k/edit!!§  Cloud Foundry: Diego Explained!https://www.youtube.com/watch?v=1OkmVTFhfLY!

Page 32: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry – Docker – Phase 1

Use Cases !•  As a user I want to push docker images from the public https://hub.docker.com (not

Dockerfile) "•  As a user I want to be able to start/stop and scale my docker image based

application "

•  As a user I can see the health of my docker image based application "

•  As an operator I want to be able to toggle docker image support "

Video – 1:05 – 4:30"

Page 33: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry – Docker – Current Limitations

Current Limitations !"•  Only public docker repositories are supported"

•  Docker images are cached on the executor node(s) (you will run out of disk space) "

•  Docker applications must listen on port 8080 "•  As a user I must know the Docker image start command to push my the application

to CF "

•  Restarting a staged Docker application may retrieve updates No direct CLI support

(later stage), you must use ‘cf curl"

•  No direct CLI support (later stage), you must use ‘cf curl’ "

Page 34: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Cloud Foundry – Docker – Next Steps

•  Docker:Staging !•  Management (fetch during staging)!

•  Docker:”Robustifed”!

•  Docker:cli!

•  Integration with CF CLI!

•  Docker:registry!•  Docker:private !

Page 35: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

!§  Diego Design Notes!§  CF Summit Keynote (Slides)!§  Cloud Foundry: Diego Explained!§  App Placement in Cloud Foundry Diego!

§  Pivotal Tracker - Diego!!!!!!

References and Links

Page 36: Docker, Cloud Foundry, Bosh & Bluemix

Meetup.com/Bluemix Meetup.com/CloudFoundry

Next Meetup:

Building Internet of Things(IoT) apps with IBM Bluemix (Powered by CloudFoundry)

IBM Bluemix Garage @ Galvanize in San Francisco!http://www.meetup.com/Bluemix/events/206223082/!http://www.meetup.com/CloudFoundry/events/206222562/!!