the-docker-way-v2

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

TheDockerWayxuli@qiniu.comAgenda•Docker:What,WhyandHow•Story:WhenQiniumeetDocker•Q&AContainerizationisthenewVirtualizationWhatisDocker•ThesameseeandsharedforeachLinux-process:•LinuxKernel•FileSystem•NetworkSystem•PID,UID,IPC,etc..•Memory,Disk,CPU,etc..BeforewelookintoContainer..andalitaboutVirtualization•Isolated:•FS,net,pid,uid,uts,mnt,ipcnamespace•Constrained:•Memory,CPU,NetworkIO,DiskIO,DiskSpaceTheprocessgroupsthatmeettheaboverestrictionsarecalledlightweightvirtualmachineorContainer.Ah..Hmm…Soundscool!Butisn'tnewyet?HardwareLinuxKVMLinuxKVMLinuxKVMLinuxKVMLinuxVirtualMachinesHardwareLinuxContainersContainerContainerContainerContainerContainerContainerContainerContainerContainervs.VMContainers  are  isolated,  but  share  OS  and,  where  appropriate,  bins/librariesApp  A  !!!!!Hypervisor  (Type  2)Host  OSServer!!!!Guest  OS  !!!!!!!Bins/  Libs  !!!App  A’  !!!!!!!!!Guest  OS  !!!!!!!Bins/  Libs  !!!App  B  !!!!!!!!!Guest  OS  !!!!!!!Bins/  Libs  !!!VM!!!!Guest  OS  !!!!!!!Guest  OS  !!!…result  is  significantly  faster  deployment,    much  less  overhead,  easier  migration,  faster  restartApp  A’Docker  Host  OSServer!!!!Bins/Libs  !!!App  A!!!!Bins/Libs  !!!App  BApp  B’App  B’ContainerApp  B’!!!!Bins/  Libs  !!!App  AOriginal  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  on  write  capabilities  allow  us  to  only  save  the  diffs  Between  container  A  and  container  A’VMs  Every  app,  every  copy  of  an  app,  and  every  slight  modification  of  the  app  requires  a  new  virtual  serverApp  A  !!!!!!!!!Guest  OS  !!!!!!!!!!Bins/  Libs  !!!Copy  of  App  !No  OS.  Can  Share  bins/libsApp  A!!!!Guest  OS  !!!!!!!!!!Guest  OS  !!!!!!VMsContainersWhyContainerslightweightDockerArchitecture(before1.x)LinuxKernelCgroupsNamespacesLayeredFSLXC(LinuXContainers)DockerTechnologyStack•Containerformat!•RunsonmostLinuxdistros•Boot2DockerforOSXandwindows•UsesLinuxKernelfeatures•StorageisprovidedbyUnionFilesystemsWhyDocker?TheChallengeStaticwebsiteWebfrontendUserDBQueueAnalyticsDBBackgroundworkersAPIendpointnginx1.5+modsecurity+openssl+bootstrap3postgresql+pgv8+v8hadoop+hive+thrift+OpenJDKRuby+Rails+sass+UnicornRedis+redis-sentinelPython3.0+celery+pyredis+libcurl+ffmpeg+libopencv+nodejs+phantomjsPython2.7+Flask+pyredis+celery+psycopg+postgresql-clientDevelopmentVMQAserverPublicCloudDisasterrecoveryContributor’slaptopProductionServersMultiplicity  of  StacksMultiplicity  of  hardware  environmentsProductionClusterCustomerDataCenterDo  services  and  apps  interact  appropriately?Can  I  migrate  smoothly  and  quickly?NxNcompatibilitynightmareStaticwebsiteWebfrontendBackgroundworkersUserDBAnalyticsDBQueueDevelopmentVMQAServerSingleProdServerOnsiteClusterPublicCloudContributor’slaptopCustomerServers??????????????????????????????????????????AnInspiration..andhistory:CargoTransportPre-1960Multiplicity  of  GoodsMultipilicity  of  methods  for  transporting/storingDo  I  worry  about  how  goods  interact  (e.g.  coffee  beans  next  to  spices)Can  I  transport  quickly  and  smoothly  (e.g.  from  boat  to  train  to  truck)Alsoamatrixfromhell??????????????????????????????????????????Solution:IntermodalShippingContainerMultiplicity  of  GoodsMultiplicity  of  methods  for  transporting/storingDo  I  worry  about  how  goods  interact  (e.g.  coffee  beans  next  to  spices)Can  I  transport  quickly  and  smoothly  (e.g.  from  boat  to  train  to  truck)…inbetween,canbeloadedandunloaded,stacked,transportedefficientlyoverlongdistances,andtransferredfromonemodeoftransporttoanotherAstandardcontainerthatisloadedwithvirtuallyanygoods,andstayssealeduntilitreachesfinaldelivery.  of  StacksMultiplicity  of  hardware  environmentsDo  services  and  apps  interact  appropriately?Can  I  migrate  smoothly  and  quickly…thatcanbemanipulatedusingstandardoperationsandrunconsistentlyonvirtuallyanyhardwareplatformAnenginethatenablesanypayloadtobeencapsulatedasalightweight,portable,self-sufficientcontainer…ThiseliminatedtheNxNproblemStaticwebsiteWebfrontendBackgroundworkersUserDBAnalyticsDBQueueDevelopmentVMQAServerSingleProdServerOnsiteClusterPublicCloudContributor’slaptopCustomerServersBuild,Ship,Run!!!“buildonce,runanywhere”–developers“configureonce,runanything”–operationsWhatcanIuseDockerfor?•ContinuousIntegration/Deployment•Packaginganddeployingapplications•BuildyourownPAAS•DeployapplicationsathyperscaleDockerBasics•Image(andLayers)•Container•Registry(like)Images•Imagesarethesourceofcontainers•Everycontainerislaunchedfromanimage•Imagesarebuiltandlayered•ImagesarestoredinaregistryLayers•Eachimageismadeupoflayers•LikeLinuxthebottomlayerisarootfilesystem•Dockerusesunionfilesystemmounting•Toplayeriswriteablea

1 / 46
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功