Download - Docker Introduction
Free Talk-Docker 2016.12.23 (haofan)
Agenda• What ?• Why ?• How ? • Docker Usercases
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?
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
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.
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…
Lightweight Platform
Open
What is Docker ?
Demo
Why use Docker ?
Build once…..run anywhere*
Config once…. run anything*
Anybody run anytime*
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
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
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
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’
How does Docker Work?
Docker Client
Host Docker Daemon
Container 1
Container 2
Container …
docker pull
docker run
docker …
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
Usercase--Microservice• What is Microservice ?• How can we deploy Microservice by docker ?
Aim to split application, to achieve agile development and deployment
From http://martinfowler.com/articles/microservices.html
Usercase--Devops• What is Devops?• How can we deploy Devops by docker ?
CI + CDContinuous IntegrationContinuous DeploymentContinuous Delivery
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
DataCenter, Big data………
How to strengthen your work by Docker ?
Reference• https://docs.docker.com/ • https://github.com/shu-frank-csdn/Linux-docker-tech-study • https://
yeasy.gitbooks.io/docker_practice/content/introduction/what.html
Thank you