Mais conteúdo relacionado


Similar a Docker module 1(20)


Docker module 1

  1. Docker Training Docker Introduction & WORKSHOP
  2. 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
  3. 8 n , D r S OcM k8 l o n O e n gtu e S p 8 o a G P 8y h Infrastructure 90% Storage, Network, Virtualization ,Container 40% Front-end, HTML, CSS, Javascript 60% Python, C Sharp, Go-lang Development 90%Liang Bo (TRYSTACK.CN )
  4. Docker Introduction
  5. 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 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.
  6. 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?
  7. 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 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
  8. 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
  9. 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
  10. Virtual$Machine
  11. Docker
  12. 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
  13. Basic$Docker System Source Code Repository Dockerfile For A Docker Engine Docker Container Image Registry Build Docker Host 2 OS (Linux) ContainerA ContainerB ContainerC ContainerA Push Search Pull Run Host 1 OS (Linux)
  14. Changes$and$Updates Docker Engine Docker Container Image Registry Docker Engine Push Update Bins/ Libs App A AppΔ Bins/ Base Container Image Host is now runningA’’ Container Mod A’’ AppΔ Bins/ Bins/ Libs App A Bins/ Bins/ Libs App A’’ Host runningA wantsto upgradetoA’’. Requests update.Gets only diffs Container Mod A’
  15. 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
  16. Working with Container !
  17. Native$Driver
  18. Driver$Interface • Abstract(Interface(to(interact(with(the(underlying(implementation type(driver(Interface({ Run((c(*Command,(…) Kill((c(*(Command) Pause((c(*Command) Name() GetProcessIdsForContainer (id(string) Terminate(() }
  19. 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
  20. Installation !
  21. Ubuntu 14.04 $ sudo apt-get update $ sudo apt-get install –y $ sudo ln –sf /usr/bin/ $ sudo sed –I ‘$acomplete –F _docker docker’ /etc/bash_completion.d/
  22. Ubuntu 14.04 – Docker Official Release (New) $ sudo apt-key adv –keyserverhkp:// –recv-keys36A1D7869245C895 $ sudo bash –c “echo deb docker main > /etc/apt/sources.list $ sudo apt-get update $ sudo apt-get installlxc-docker
  23. Working with Image !
  24. Get Image $ sudo docker pull ubuntu:14.04 Pullingrepositoryubuntu 07f8e8c5e660:Downloadcomplete e9e06b06e14c: Downloadcomplete a82efea989f9: Downloadcomplete 37bea4ee0c81: Downloadcomplete
  25. Get Image From Specific Server $ sudo docker pull ubuntu:14.04 Pullingrepositoryubuntu 07f8e8c5e660:Downloadcomplete e9e06b06e14c: Downloadcomplete a82efea989f9: Downloadcomplete 37bea4ee0c81: Downloadcomplete
  26. List Images $ sudo docker images REPOSITORY TAG IMAGEID CREATED VIRTUAL SIZE ubuntu 14.04 07f8e8c5e660 2weeks ago 188.3MB
  27. OpenStack Integration !
  28. OpenStack Introduction !
  29. What$is$OpenStack “Open%source software*for*building private%and%public%clouds” 33OpenStack*Foundation
  30. OpenStack$Projects • Core Projects • Nova(Compute Service) • Glance (Image Service) • Neutron (Network Service) • Cinder (Block StorageService) • Swift (Object StorageService) • Common Projects • Keystone (Identity Service) • Horizon (Dashboard) • Ceilometer (Telemeter Service) • Heat (Orchestration Service) • Shared Modules • Oslo (Shared Infrastructure Code) • Incubation Projects • Magnum (Container Service)
  31. 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
  32. OpenStack$Project
  33. OpenStack$Classic$Deployment
  34. OpenStack$Communication UI:%Horizon%/%CLI Cinder%API Scheduler Cinder%DB Queue Cinder Cinder%Vol Nova%API Scheduler Conductor Nova%Cell Queue Nova%DB Nova Nova Nova@Compute Nova Hyperviso r Compute/Node VM Network Router/GW DHCP/IPAM Network/Node Storage Block/ Storage/Node Glance%API Glance%Registry Glance%DB Glance Proxy%Server Object%Store Swift Plugin% /Agent Neutron%DB Neutron%Server Neutron Plugin%/Agent Keystone%Server Keystone%DB Keystone
  35. Compute$Scheduler
  36. Compute$Driver Container Container Container Docker
  37. Demo - Nova Driver – (Docker as compute Service) !
  38. Demo - Glance as Docker Image Registry !
  39. Questions?