COURSE INTRODUCTION
DAY 01
• Docker Introduction
• Installation of Docker
• Working with Containers
• Working with Images
• Building image with Dockerfiles
• OpenStack Integration
• OpenStack Introduction
• Nova Driver (Docker as Compute
Service)
• Glance as Docker image registry
DAY 02
• Docker Cluster
• Kubernetes Introduction
• Docker Networking
• Docker Hub
• Docker Cases
• Docker Source Code
• Development Platform With
Docker
• Hadoop on Docker
8 n , D r
S OcM k8 l
o n O e n gtu
e S p 8 o
a G P 8y
h
liangbo@trystack.cn
http://github.com/onetown
http://liangbo.me
Infrastructure 90%
Storage, Network, Virtualization ,Container 40%
Front-end, HTML, CSS, Javascript 60%
Python, C Sharp, Go-lang Development 90%Liang Bo (TRYSTACK.CN )
Docker For Beginners
Docker is an open platform for developers and sysadmins tobuild, ship, and run distributed applications.Consisting ofDocker Engine, a portable, lightweight runtime and
packaging tool, and Docker Hub, a cloudservice for sharing applications and automating workflows,Docker enables apps tobe quickly assembledfrom components and
eliminates the frictionbetweendevelopment,QA, and production environments. As a result,IT can ship faster and run the same app,unchanged,on laptops, data center VMs,
and any cloud.
03
Looking for Something Specific
Develop, Ship and Runany application,anywhere
04
Looking for Help
https://docs.docker.com
02
Learning
Docker consists of:
The Docker Engine - our lightweight and powerful open source container
virtualization technology combined witha work flow for building and
containerizing your applications.
Docker Hub - our SaaS service for sharing and managing your application
stacks.
01
Installation
Docker requires a 64-bit installation regardless of your Linux
version. Additionally, your kernel must be 3.10 at minimum. The
latest 3.10 minor versionor a newer maintained version are also
acceptable.
The$Challenge
Static website
Web frontend
User DB
Queue Analytics DB
Backgroundworkers
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
PublicCloud
Disaster recovery
Contributor’slaptop
ProductionServers
MultiplicityofStacks
Multiplicityof
hardware
environments
ProductionCluster
CustomerData Center
Doservicesandapps
interactappropriately?
CanImigratesmoothly
andquickly?
Application$Matrix
Static website
Web frontend
Background workers
User DB
Analytics DB
Queue
Development VM QA Server Single Prod Server Onsite Cluster Public Cloud Contributor’s laptop Customer Servers
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
Explanation
• High Level—It’s a lightweight VM
• Own process space
• Own network interface
• Can run stuff asroot
• Can have itsown/sbin/init (different from
host)
• <<machine container>>
• Low Level—It’s chroot on steroids
• Can alsonot have itsown/sbin/init
• Container=isolatedprocesses
• Share kernelwithhost
• Nodevice emulation (neither HVM nor PV)
fromhost)
• <<application container>>
• Runeverywhere
• Regardless of kernel version (2.6.32+)
• Regardless of host distro
• Physical or virtual, cloudor not
• Containerand host architecturemust
match*
• Run anything
• If it can run onthe host,it canrun in the
container
• i.e. if it can run ona Linuxkernel, it can run
WHY WHAT
Introduction
• Docker is an open-sourceengine that automatesthe deployment of any application as a
lightweight, portable, self-sufficient container that will runvirtually anywhere.
• Based onLXC (Linux Container), easy to use.
• Similar to VM asend-user with different features.
• Founded in 2013 (dotCloud)
• Joined Linux Foundation
• Apache 2.0 License
• Implemented by Golang
Bins/
Libs
App
A
Original App
(No OS to take
up space, resources,
or require restart)
AppΔ
Bins/
App
A
Bins/
Libs
App
A’
Guest
OS
Bins/
Libs
Modified App
Copy onwritecapabilities
allow
us to onlysave the diffs
Between container A and
container
A’
VMs
Every app, every copy ofan
app, and every slight modification
of the app requires a new virtual server
App
A
Guest
OS
Bins/
Libs
Copy of App
No OS. Can
Share bins/libs
App
A
Guest
OS
Guest
OS
VMs Containers
Ecosystem
• Operatingsystems
• Virtually anydistribution with a 2.6.32+ kernel
• Red Hat/Docker collaboration to makework acrossRHEL 6.4+, Fedora, and other membersof thefamily (2.6.32 +)
• CoreOS—Small coreOS purposebuilt with Docker
• OpenStack
• Docker integration into NOVA(& compatibility with Glance, Horizon, etc.) accepted for Havana release
• Private PaaS
• OpenShift
• Solum (Rackspace, OpenStack)
• Public PaaS
• Deis, Voxoz, Cocaine (Yandex), Baidu PaaS
• Public IaaS
• Native support in Rackspace, Digital Ocean,+++
• AMI (or equivalent) available for AWS & other
• DevOps Tools
• Integrationswith Chef, Puppet, Jenkins, Travis, Salt, Ansible+++
• Orchestration tools
• Mesos, Heat, ++
• Shipyard &otherspurposebuilt for Docker
• Applications
• 1000’s of Dockerized applications available at index.docker.io
Run Docker ?
$ sudo docker run ubuntu:14.04 /bin/echo 'Hello world’
Hello world
sudo docker run -t -i ubuntu:14.04 /bin/bash
root@73a19a637b54:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp
usr var
Get Image From Specific Server
$ sudo docker pull dl.dockerpool.com:5000 ubuntu:14.04
Pullingrepositoryubuntu
07f8e8c5e660:Downloadcomplete
e9e06b06e14c: Downloadcomplete
a82efea989f9: Downloadcomplete
37bea4ee0c81: Downloadcomplete
List Images
$ sudo docker images
REPOSITORY TAG IMAGEID CREATED VIRTUAL SIZE
ubuntu 14.04 07f8e8c5e660 2weeks ago 188.3MB
OpenStack$Project
• Eachproject is a “top-level” OpenStack part
• Eachproject has a “Project TechnicalLeader” (PTL)
• Eachproject has different developers and designers
• Eachproject has well designed public API
• Except Horizon, it’s a WEB UI
• Allother project providea RESTful API(JSON/HTTP)
• Eachproject has isolated database