docker introduction

25
Free Talk-Docker 2016.12.23 (haofan)

Upload: -

Post on 15-Apr-2017

50 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: Docker Introduction

Free Talk-Docker 2016.12.23 (haofan)

Page 2: Docker Introduction

Agenda• What ?• Why ?• How ? • Docker Usercases

Page 3: Docker Introduction

Static website

Web frontend

User DBQueue 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 recoveryContributor’s laptop

Production Servers

The ChallengeM

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?

Page 4: Docker Introduction

Mul

tiplic

ity o

f Goo

dsM

ultip

ilici

ty o

f m

etho

ds fo

r tr

ansp

ortin

g/st

orin

g

Do I worry about

how goods interact

(e.g. coffee beans next to spices)

Can I transport quickly and sm

oothly(e.g. from

boat to train to truck)

Transport Pre-1960

Page 5: Docker Introduction

Solution: Intermodal Shipping Container

…in between, can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another

A standard container that is loaded with virtually any goods, and stays sealed until it reaches final delivery.

Page 6: Docker Introduction

Static website Web frontend User DB Queue Analytics DB

Development VM

QA server Public Cloud Contributor’s laptop

Docker is a shipping container system for code

Production Cluster

Customer Data Center

…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…

Page 7: Docker Introduction

Lightweight Platform

Open

What is Docker ?

Page 8: Docker Introduction

Demo

Page 9: Docker Introduction

Why use Docker ?

Build once…..run anywhere*

Config once…. run anything*

Anybody run anytime*

Page 10: Docker Introduction

Docker Containers vs VMApp

A

Hypervisor (Type 2)

Host OS

Server

GuestOS

Bins/Libs

AppA’

GuestOS

Bins/Libs

AppB

GuestOS

Bins/Libs

App A’

Docker

Host OS

Server

Bins/LibsApp A

Bins/Libs

App B

App B’

App B’

App B’VM

Container

Containers are isolated,but share OS and, whereappropriate, bins/libraries

GuestOS

GuestOS

…result is significantly faster deployment, much less overhead, easier migration, faster restart

Page 11: Docker Introduction

Docker Containers vs VM

Feature Container VM

start Seconds level Minitues level

Hardisk MB GB

Performance Native Less than Native

Stand-alone Thouands of containers Tens of VM

Page 12: Docker Introduction

Basic Docker System

Source Code

Repository

DockerfileFor

A

Docker Engine

Build

Docker

Host 2 OS (Linux)

Container A

Container B

Container C

Push

Search Pull

Run

Host 1 OS (Linux)

DockerContainer

Image Registry

Image

Page 13: Docker Introduction

Changes and Updates

Docker Engine

DockerContainer

Image Registry

Docker Engine

Push

Update

Bins/Libs

AppA

App Δ

Bins/

Base Container

Image

Container Mod A’’

App Δ

Bins/

Bins/Libs

AppA

Bins/

Bins/Libs

AppA’’

Container Mod A’

Page 14: Docker Introduction

How does Docker Work?

Docker Client

Host Docker Daemon

Container 1

Container 2

Container …

docker pull

docker run

docker …

Page 15: Docker Introduction

Docker Technology • Namespaces: uts, pid, net, ipc, mnt(Environmnet Isloate)• Cgroup: resource limitation, prioritization, process control(Resource

Control)• AUFS(Union File System): save storage space, fast deploy, simple to

upgrade(Image Mangement)

https://github.com/shu-frank-csdn/Linux-docker-tech-study

Page 16: Docker Introduction

Usercase--Microservice• What is Microservice ?• How can we deploy Microservice by docker ?

Page 17: Docker Introduction

Aim to split application, to achieve agile development and deployment

Page 18: Docker Introduction

From http://martinfowler.com/articles/microservices.html

Page 19: Docker Introduction

Usercase--Devops• What is Devops?• How can we deploy Devops by docker ?

Page 20: Docker Introduction

CI + CDContinuous IntegrationContinuous DeploymentContinuous Delivery

Page 21: Docker Introduction

Version control system

Continuous Integration

Server

Test Instance

Production

CI notifies of pass / fail

Developer Pulls From Trunk

1

Make incremental changes on local environment

2

Developer pushes commits

3

CI monitors repository for changes

4

Changes Kick off test Build

5

Run Tests:Unit

IntegrationSmoke

6

Report back test results 7

Artifact Repository

9

Pushing to prod could just mean changing the

reverse proxy serverIf tests pass:

Deploy code to artifact

repository

8

Bringing it all together

Page 22: Docker Introduction

DataCenter, Big data………

Page 23: Docker Introduction

How to strengthen your work by Docker ?

Page 25: Docker Introduction

Thank you