Download - Láďa Prskavec: Docker.io
![Page 1: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/1.jpg)
Ladislav Prskavec @abtris -‐ DEVEL 9.11.2013
�1
![Page 2: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/2.jpg)
Docker is an open-‐source project to easily create lightweight, portable, self-‐sufficient containers from any applicaHon.
�2
![Page 3: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/3.jpg)
The same container that a developer builds and tests on a laptop can run at scale, in producHon, on VMs, bare metal, OpenStack clusters, public clouds and more.
�3
![Page 4: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/4.jpg)
�4
![Page 5: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/5.jpg)
BeNer than VMs
★ Size
�5
![Page 6: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/6.jpg)
BeNer than VMs
★ Size
★ Performance
�6
![Page 7: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/7.jpg)
BeNer than VMs
★ Size
★ Performance
★ Portability
�7
![Page 8: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/8.jpg)
BeNer than VMs
★ Size
★ Performance
★ Portability
★ Hardware-‐centric
�8
![Page 9: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/9.jpg)
Escape dependency hell
★ Cross-‐plaRorm dependencies
�9
![Page 10: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/10.jpg)
Escape dependency hell
★ Cross-‐plaRorm dependencies
★ ConflicHng dependencies
�10
![Page 11: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/11.jpg)
Escape dependency hell
★ Cross-‐plaRorm dependencies
★ ConflicHng dependencies
★ Custom dependencies
�11
![Page 12: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/12.jpg)
Here's a typical Docker build process (Dockerfile)
from ubuntu:12.10
run apt-‐get update
run DEBIAN_FRONTEND=noninteractive apt-‐get install -‐q -‐y python
run DEBIAN_FRONTEND=noninteractive apt-‐get install -‐q -‐y python-‐pip
run pip install django
run DEBIAN_FRONTEND=noninteractive apt-‐get install -‐q -‐y curl
run curl -‐L https://github.com/shykes/helloflask/master.tar.gz | tar -‐xzv
run cd helloflask-‐master && pip install -‐r requirements.txt
�12
![Page 13: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/13.jpg)
Under the hood
★ GO
★ The cgroup and namespacing capabiliHes of the Linux kernel
�13
![Page 14: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/14.jpg)
Under the hood
★ GO
★ The cgroup and namespacing capabiliHes of the Linux kernel
★ AUFS, a powerful union filesystem with copy-‐on-‐write capabiliHes
�14
![Page 15: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/15.jpg)
Under the hood
★ GO
★ The cgroup and namespacing capabiliHes of the Linux kernel
★ AUFS, a powerful union filesystem with copy-‐on-‐write capabiliHes
★ lxc, a set of convenience scripts to simplify the creaHon of Linux containers
�15
![Page 16: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/16.jpg)
Zero downHme deployment
using private registry
�16
![Page 17: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/17.jpg)
�17
App running in prod hNp://praguejs.cz !!!
-‐ Build local
> docker build -‐t=praguejs .
-‐ Test local
> docker run -‐p 49200:3333 praguejs
hNp://localhost:49200
-‐ Change some files
-‐ Rebuild & test
> docker build -‐t praguejs
> docker run -‐p 49200:3333 praguejs
vagrant@precise64:~$ docker ps CONTAINER ID IMAGE b2332dffe registry.abtris.cz:5000/praguejs:latest
![Page 18: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/18.jpg)
�18
Push to producHon • Tag image in order to push it> docker tag praguejs registry.abtris.cz:5000/praguejs
• Push image to local registry> docker push registry.abtris.cz:5000/praguejs
• On producHon server, pull image> docker pull registry.abtris.cz:5000/praguejs
• Start new container > docker run -‐d -‐p 127.0.0.1::3333 <image>
• Change configuraHon at nginx/haproxy and restart
• See changes live
vagrant@precise64:~$ docker ps CONTAINER ID IMAGE b2332dffe registry.abtris.cz:5000/praguejs:latest d45222331 1b4f43asds
![Page 19: Láďa Prskavec: Docker.io](https://reader033.vdocuments.us/reader033/viewer/2022042714/554a2957b4c90526578b4c25/html5/thumbnails/19.jpg)
�19