Docker Container As A Service - JAX 2016

103
Container as a Service with Docker Patrick Chanezon, Docker Inc. @chanezon

Transcript of Docker Container As A Service - JAX 2016

Page 1: Docker Container As A Service - JAX 2016

Container as a Service with Docker

Patrick Chanezon, Docker Inc.@chanezon

Page 2: Docker Container As A Service - JAX 2016

French

Polyglot

Platforms

Software Plumber

San Francisco

Developer Relations

@chanezon

Page 3: Docker Container As A Service - JAX 2016

1995 2015

Page 4: Docker Container As A Service - JAX 2016

“The future is already here — it's just not very evenly

distributed”William Gibson, Neuromancer

Page 5: Docker Container As A Service - JAX 2016

Docker’s mission is tobuild tools of mass

innovation

Page 6: Docker Container As A Service - JAX 2016

Internet (hardware layer)

Servers Desktops Phones Cars Houses Drones

Network equipmen

tPublic transit

TVsIndustri

al facilities

Scientific instrumen

tsFinancial system

Programmers

Internet (software layer)

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

Page 7: Docker Container As A Service - JAX 2016

Internet (hardware layer)

Servers Desktops Phones Cars Houses Drones

Network equipmen

tPublic transit

TVsIndustri

al facilities

Scientific instrumen

tsFinancial system

Programmers

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

App

a software layer to program the internet

Page 8: Docker Container As A Service - JAX 2016

Cloud Market

PublicHybridPrivate

IT Pros Devops DevelopersArchitects

Page 9: Docker Container As A Service - JAX 2016

Linux Container Ecosystem

flockerglusterfs

weavecalicomidokuracisconuage

Cloud

OS

Plugins

Orchestration

Page 10: Docker Container As A Service - JAX 2016

Devops

Page 11: Docker Container As A Service - JAX 2016

25

Mainframe

Page 12: Docker Container As A Service - JAX 2016

Client-Server

26

Page 13: Docker Container As A Service - JAX 2016

27

Web

Page 14: Docker Container As A Service - JAX 2016

28

Cloud - Devops

Page 15: Docker Container As A Service - JAX 2016

25

Mainframe

Page 16: Docker Container As A Service - JAX 2016

Devops• Cultural movement • Inspired by agile methods• People, Processes & Tools• Continuous delivery• Infrastructure as code• Cross silo collaboration• Small iterations• Feedback loop, measurement

Image from Patrick Deboishttp://www.slideshare.net/jedi4ever/devops-the-war-is-over-if-you-want-ithttp://www.slideshare.net/jedi4ever/devopsdays-downundervfinal

Page 17: Docker Container As A Service - JAX 2016

Devops: singing Kumbaya?

Page 18: Docker Container As A Service - JAX 2016
Page 19: Docker Container As A Service - JAX 2016
Page 20: Docker Container As A Service - JAX 2016
Page 21: Docker Container As A Service - JAX 2016

Low MTBIAMSH

MTBIAMSH (Mean Time Between Idea And Making Stuff Happen)

Page 22: Docker Container As A Service - JAX 2016

Devops + Agility == $$

Page 23: Docker Container As A Service - JAX 2016

Docker

Page 24: Docker Container As A Service - JAX 2016
Page 25: Docker Container As A Service - JAX 2016
Page 26: Docker Container As A Service - JAX 2016

Isolation using Linux kernel featuresnamespaces

pid mnt net uts ipc user

cgroups memory cpu blkio devices

Page 27: Docker Container As A Service - JAX 2016

Image layers

Page 28: Docker Container As A Service - JAX 2016

Docker Mission

Page 29: Docker Container As A Service - JAX 2016

Docker for developers

https://registry.hub.docker.com/_/java/

Page 30: Docker Container As A Service - JAX 2016

docker-compose: running multiple containers Run your stack with one command: docker-compose

up Describe your stack with one file: docker-compose.ymlweb: build: . command: python app.py ports: - "5000:5000" volumes: - .:/code links: - redis:redis

redis: image: redis

Page 31: Docker Container As A Service - JAX 2016

Docker for Mac and Windows private beta

https://beta.docker.com/

Page 32: Docker Container As A Service - JAX 2016

defaultDOCKER_HOST=tcp://xxx.xxx.xxx.xxx:2376DOCKER_MACHINE_NAME=defaultDOCKER_TLS_VERIFY=1DOCKER_CERT_PATH=$HOME/.docker/machine/machines/default

IP xxx.xxx.xxx.xxx

manages

Docker Toolbox

Page 33: Docker Container As A Service - JAX 2016

unset ${!DOCKER_*}

docker.local

symlink /var/tmp/docker.sock

manages

Docker for Mac

Page 34: Docker Container As A Service - JAX 2016

unset ${!DOCKER_*}

docker.local

symlink /var/tmp/docker.sock

manages

default

IP xxx.xxx.xxx.xxx

manages

DOCKER_HOST=tcp://xxx.xxx.xxx.xxx:2376DOCKER_MACHINE_NAME=defaultDOCKER_TLS_VERIFY=1DOCKER_CERT_PATH=$HOME/.docker/machine/machines/default

Docker for Mac and Toolbox

Page 35: Docker Container As A Service - JAX 2016

Linux X11 Apps on Docker for Mac

https://github.com/chanezon/docker-tips/x11

Page 36: Docker Container As A Service - JAX 2016

docker-machine

docker-machine create -d azure \—azure-subscription-id="c4f51be3-784c-xxx-7c50ad9e1b7c" \--azure-subscription-cert="/Users/pat/.ssh/docker-azure-cert.pem" \--azure-location="East US" \--azure-size=Small \--azure-username="pat" \pat-docker-machine-n

Page 37: Docker Container As A Service - JAX 2016
Page 38: Docker Container As A Service - JAX 2016

Kitematic

Page 39: Docker Container As A Service - JAX 2016

Docker Mission

Page 40: Docker Container As A Service - JAX 2016

Docker Hub

Page 41: Docker Container As A Service - JAX 2016

Docker Hub

Dev & QA ColleaguesDevelopers

QA

Build & Ship

Page 42: Docker Container As A Service - JAX 2016

Docker Trusted Registry

Page 43: Docker Container As A Service - JAX 2016
Page 44: Docker Container As A Service - JAX 2016

Docker Mission

Page 45: Docker Container As A Service - JAX 2016

SwarmScheduler

plugins

Engine

Volumes plugins

Network plugins

Service discovery plugins

Engine

Volumes plugins

Network plugins

Service discovery plugins

mesos

flockerglusterfs

weavecalico

consuletcdzookeeper

midokuraciscoazurenuagenetworks

Docker Plugins

Batteries included but removable

Page 46: Docker Container As A Service - JAX 2016

DockerCLI

DockerCLI

DockerCLI

Docker Engine

Page 47: Docker Container As A Service - JAX 2016

us-west us-east

DockerCLI

DockerCLI

Docker Swarm

Swarm

Page 48: Docker Container As A Service - JAX 2016

Swarm load balancing: interlock

https://github.com/ehazlett/interlock/tree/master/plugins/haproxy

Page 49: Docker Container As A Service - JAX 2016

Docker Datacenter

Page 50: Docker Container As A Service - JAX 2016

Docker Cloud

Page 51: Docker Container As A Service - JAX 2016

Open Standards

Page 52: Docker Container As A Service - JAX 2016
Page 53: Docker Container As A Service - JAX 2016

Plumbing

Page 54: Docker Container As A Service - JAX 2016

Notary“Let’s stop using curl|sh”

Trusted collections for any content

Transport-agnostic

Reliable updates, proof of origin, resistant to untrusted transport, survivable key compromise

Build on industry-leading standards and research

Page 55: Docker Container As A Service - JAX 2016

RunCThe universal container runtime

https://runc.io

Page 56: Docker Container As A Service - JAX 2016

containerdA daemon to control runC

built for performance and density

http://containerd.tools/

Page 57: Docker Container As A Service - JAX 2016

containerd

Page 58: Docker Container As A Service - JAX 2016

Docker 1.11

Page 59: Docker Container As A Service - JAX 2016

Docker & Microsoft

Page 60: Docker Container As A Service - JAX 2016

Docker & Microsoft• Build

• Docker Toolbox & Kitematic for Windows• Docker for Windows beta• Docker engine on Windows Server 2016 TP4• yo-docker to dockerize existing projects• Visual Studio Docker Tools

• Ship• VSTS extension for Docker beta

• Run• Azure Docker agent• ACS• Docker datacenter on Azure ARM template• Azure Container Service

Page 61: Docker Container As A Service - JAX 2016

Unikernels

Page 62: Docker Container As A Service - JAX 2016

Unikernel Systems + Docker

Page 63: Docker Container As A Service - JAX 2016

Unikernels

http://unikernel.org/

Page 64: Docker Container As A Service - JAX 2016

Unikernelsspecialised, single-address-space machine images constructed by using library

operating systems.• Smaller

• link only the parts of the OS lib you need• Faster

• fast boot• compiler can perform whole-system optimization

• More secure• reduced attack surface

Page 65: Docker Container As A Service - JAX 2016

Unikernels & Docker

http://unikernel.org/blog/2015/unikernels-meet-docker/https://github.com/Unikernel-Systems/DockerConEU2015-demo

Page 66: Docker Container As A Service - JAX 2016

Docker CaaS

Page 67: Docker Container As A Service - JAX 2016

The Docker mission

Build Ship Run

Anywhere

Distributed Applications

Page 68: Docker Container As A Service - JAX 2016

5

XaaS Pyramid

Platform As A Service

Infrastructure As A Service

SoftwareAs A Service

Page 69: Docker Container As A Service - JAX 2016
Page 70: Docker Container As A Service - JAX 2016
Page 71: Docker Container As A Service - JAX 2016

5

Goldilocks and the 3 XaaS

Just rightToo highToo lowIaaS PaaS CaaS

Page 72: Docker Container As A Service - JAX 2016

5

Goldilocks and the 3 XaaS

Platform As A Service

Infrastructure As A Service

SoftwareAs A Service

Too high

Too low

Just right

Container As A Service

Page 73: Docker Container As A Service - JAX 2016

5

Goldilocks and the 3 XaaS

Container As A Service

Infrastructure As A Service

SoftwareAs A Service

Page 74: Docker Container As A Service - JAX 2016

Docker Containers as a Service (CaaS)An IT managed and secure application content and infrastructure where developers can self service build and deploy applications

Page 75: Docker Container As A Service - JAX 2016

The Docker Journey: The Power of AND

Manage and secure at scale

Frictionless movement

Innovation at speed

+ +Agility Portability Control

Page 76: Docker Container As A Service - JAX 2016

Docker survey 2016 - Enabling the Software Supply Chain

Page 77: Docker Container As A Service - JAX 2016

Lessons learned: Avoid these pitfalls

12

3

Developers don’t adopt locked down systems

Existing “end to end” solutions break the Docker experience

Beware of lock-in and loss of portability

Page 78: Docker Container As A Service - JAX 2016

Let’s Play: Where’s Whaledo

Page 79: Docker Container As A Service - JAX 2016

in Google Container Engine?$ docker build -t gcr.io/${PROJECT_ID}/hello-node .$ gcloud docker push gcr.io/${PROJECT_ID}/hello-node$ gcloud container clusters create hello-world \ --num-nodes 1 \ --machine-type g1-small$ kubectl run hello-node --image=gcr.io/$

{PROJECT_ID}/hello-node --port=8080$ kubectl get services hello-node$ kubectl scale rc hello-node --replicas=3

https://cloud.google.com/container-engine/docs/tutorials/hello-node

Page 80: Docker Container As A Service - JAX 2016

in Kubernetes?

Page 81: Docker Container As A Service - JAX 2016

in EC2 Container Service?$ ecs-cli up --keypair id_rsa --capability-iam \—size 2 --instance-type t2.medium

create a compose file

$ ecs-cli compose --file hello-world.yml up$ ecs-cli ps$ ecs-cli compose --file hello-world.yml scale 2$ ecs-cli compose --file hello-world.yml service up

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_tutorial.html

Page 82: Docker Container As A Service - JAX 2016

in Red Hat?$ ./openshift kube apply -c docker-registry-config.jsonOpenShift relies on the concept of Builds to turn your

application source into a runnable Docker image$ ./openshift kube create buildConfigs -c application-

buildconfig.json$ curl -s -A "GitHub-Hookshot/github" -H "Content-

Type:application/json" -H "X-Github-Event:push" -d @github-webhook-example.json http://localhost:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github$ ./openshift kube process -c application-template.json |

./openshift kube apply -c -

https://blog.openshift.com/openshift-v3-deep-dive-docker-kubernetes/

Page 83: Docker Container As A Service - JAX 2016

in Red Hat?

https://blog.openshift.com/openshift-v3-deep-dive-docker-kubernetes/

Page 84: Docker Container As A Service - JAX 2016

in Pivotal Cloud Foundry?$cf api --skip-ssl-validation api.bosh-lite.com$cf auth admin admin$cf create-org diego$cf target -o diego$cf create-space diego$cf target -s diego$cf push my-app --no-start$cf start my-app

https://github.com/cloudfoundry-incubator/diego-release

Page 85: Docker Container As A Service - JAX 2016

in Pivotal Cloud Foundry?

runC

Page 86: Docker Container As A Service - JAX 2016

Developers IT Operations

BUILDDeveloper Workflows

SHIPSecure Content & Collaboration

RUNDeploy, Manage, Scale

Docker CaaS Platform

Page 87: Docker Container As A Service - JAX 2016

Docker Containers as a Service platform

BUILDDeveloper Workflows

SHIPRegistry Services

RUNManagement

Docker Toolbox Docker Trusted Registry Docker Universal Control Plane

Docker Cloud

Docker Engine

Ecosystem Plugins and Integrations

Page 88: Docker Container As A Service - JAX 2016

Characteristics of a CaaS

Any Infrastructure

Any Operating System

Any Language

Any App Architecture

Any Application

Stage

Developers + IT Ops

The Power of AND

Open APIs Broadest Ecosystem Support

Page 89: Docker Container As A Service - JAX 2016

Docker accelerates modern app initiatives

Cloud

Microservices

80%Docker is central to

cloud strategy

State of App development Survey: Q1 - 2016

3 out 4 Top initiatives revolve around applications

44%Looking to adopt

DevOpsDevOps

Page 90: Docker Container As A Service - JAX 2016

Use Case: Decentralized CaaS for hybrid and multi cloud portability

Private datacenter for regulated apps

Central Portal

• Provision resources

• RBAC to VPC / datacenter

• Trusted Registry hosted application templates

Cloud for all other apps

VPC 1 VPC2

App 1 App 2 App

App 1 App 2 App

Cloud Portability

App Portability

Page 91: Docker Container As A Service - JAX 2016

Use Case: Centralized CaaS for transformation to DevOps and micro services

After

Authorization

App Registration

Session Management

Marketplace Integration

Logging

…more

Trusted Registry App Service App Service

App A App B

Auth

…more

App Reg

Marketplace

Logging

Auth

Session

…more

App Reg

Logging

Before

App TeamsApp BAuth

App Reg Marketplace

Logging

App Service

Universal Control Plane

App AAuth

App Reg Marketplace

Logging

App Service

App BAuth

App Reg Marketplace

Logging

App Service

App AAuth

App Reg Marketplace

Logging

App Service

Portability

Page 92: Docker Container As A Service - JAX 2016

Demos

Page 93: Docker Container As A Service - JAX 2016

• Docker Swarm, Compose and networking• docker 1.11• swarm 1.1.0• compose 1.6.0 with networking• Run/Debug with STS IDE in

a container

Spring Boot App using MongoDB

https://github.com/joshlong/spring-doge

https://github.com/chanezon/docker-tips/orchestration-networkinghttps://github.com/chanezon/spring-doge

Page 94: Docker Container As A Service - JAX 2016

Docker Universal Control Plane

https://github.com/chanezon/docker-tips/tree/master/azure-acs-ucp

Page 95: Docker Container As A Service - JAX 2016

Load balancing in UCP with Interlock

See "Reference Architecture: Service Discovery and Load Balancing with Docker Universal Control Plane (UCP)"

Page 96: Docker Container As A Service - JAX 2016

ucp-controller

Cloud LB

ucp-node-1 ucp-node-2

Cloud LB

etcd InterlockSwarm ucp-proxy nginx nginx

Configuration

Reconfigures

myapp:314

myapp:42

myapp:1968

myapp.comdocker run myapp

Load balancing in UCP with Interlock

https://github.com/chanezon/docker-tips/orchestration-networking

InterlockEvents

Page 97: Docker Container As A Service - JAX 2016

THANK YOU

Page 98: Docker Container As A Service - JAX 2016

Let’s Dockerize a Neo4J App

https://github.com/neo4j-examples/movies-java-spring-data-neo4j-4

Page 99: Docker Container As A Service - JAX 2016

• Service Discovery• https://github.com/gliderlabs/registrator• https://github.com/hashicorp/consul-template• https://github.com/ehazlett/interlock

• Persistent volumes with Swarm and Rex Ray on AWS• http://blog.emccode.com/2015/11/03/use-docker-swarm-with-

a-data-persistence-layer/• https://github.com/emccode/rexray

• Kubernetes on Swarm• https://github.com/docker/swarm-frontends

Orchestration projects

Page 100: Docker Container As A Service - JAX 2016

• IPVS, Andrey Sibiryov, http://www.slideshare.net/Docker/kernel-load-balancing-for-docker-containers-using-ipvs

• DNS Service Discovery for Docker Swarm, Ahmet Alp Balkan, http://www.slideshare.net/Docker/dns-service-discovery-for-docker-swarm

Load Balancing

Page 101: Docker Container As A Service - JAX 2016

• Spring Boot, MongoDB, compose, swarm, networking• https://github.com/joshlong/spring-doge• https://github.com/chanezon/docker-tips/orchestration-

networking• Java EE 7 / Angular App with Docker Swarm by @mgreau

Compose for build and deploy, Wildfly, Apache, Angular, Mysql, Redis, batch and API apps• https://github.com/mgreau/docker4dev-tennistour-app

• Java EE Docker & Kubernetes by @arun-gupta• https://github.com/javaee-samples/docker-java

Java Examples

Page 102: Docker Container As A Service - JAX 2016

• Docs https://docs.docker.com/engine/userguide/networking/dockernetworks/

• Create a Swarm cluster with networking https://github.com/chanezon/docker-tips/orchestration-networking

• Networking in compose https://github.com/docker/compose/blob/master/docs/networking.md

• Nathan Leclaire Seamless Docker Multihost Overlay Networking on DigitalOcean With Machine, Swarm, and Compose, RethinkDB http://nathanleclaire.com/blog/2015/11/17/seamless-docker-multihost-overlay-networking-on-digitalocean-with-machine-swarm-and-compose-ft.-rethinkdb/

Docker networking

Page 103: Docker Container As A Service - JAX 2016

• Using Ansible with Docker Machine to Bootstrap Host Nodes http://nathanleclaire.com/blog/2015/11/10/using-ansible-with-docker-machine-to-bootstrap-host-nodes/

• Seamless Docker Multihost Overlay Networking on DigitalOcean With Machine, Swarm, and Compose, RethinkDB http://nathanleclaire.com/blog/2015/11/17/seamless-docker-multihost-overlay-networking-on-digitalocean-with-machine-swarm-and-compose-ft.-rethinkdb/

Nathan’s tips