docker - sela sdp 2015
TRANSCRIPT
![Page 1: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/1.jpg)
© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
SELA DEVELOPER PRACTICEMay 31 – June 4 , 2015
Rotem OrConsultant/Architect, Sela Group
![Page 2: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/2.jpg)
AgendaHistoryWhat is DockerVirtual machines vs. ContainersCommunity Run docker locallyRun docker on azureDocker machineDocker FilesDocker ComposeDocker Swarm
![Page 3: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/3.jpg)
History of docker
![Page 4: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/4.jpg)
Once upon a time around 2011Solomon Hykes
a Paas (Platform as a service) company Manages Infrastructure for developers who don’t want to handle infra by them self
Around 2012 – 2013 dotCloud opened source the core technology of the company as a side project named Docker
![Page 5: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/5.jpg)
A few month later This little side project became huge
160 contributors 4000 GitHub stars 1000+ tickets 250 pull request
![Page 6: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/6.jpg)
As for today Docker has raised until now around
100,000,000 $$$
One of the fastest growing startup technologyOne of the fasted adoption in enterprise world
![Page 7: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/7.jpg)
What is
Docker?
![Page 8: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/8.jpg)
Questions
![Page 9: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/9.jpg)
The ProblemShipping code to server a few years ago
![Page 10: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/10.jpg)
The ProblemShipping code to server today
![Page 11: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/11.jpg)
Deployment is a pain As we all know the deployment process made super complicated and time consuming Today we use many new technologies and we deploy them to multiple devices / servers / cloud provides Each device/server/cloud provider is a complete new deployment / testing / load testing Human errors We need a lot of recourses to test each flavor
![Page 12: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/12.jpg)
The matrix from hell
![Page 13: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/13.jpg)
Similar problem The shipping Industry
![Page 14: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/14.jpg)
It kind of looks like this
![Page 15: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/15.jpg)
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
? ? ? ? ? ?
Another matrix from hell
![Page 16: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/16.jpg)
The Solution
![Page 17: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/17.jpg)
No need for the Matrix
![Page 18: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/18.jpg)
The Solution
![Page 19: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/19.jpg)
Virtual Machine
VSDocker
Containers
![Page 20: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/20.jpg)
VM vs Docker
Each virtualized application includes not only the application - which may be only 10s of MB - and the necessary binaries and libraries, but also an entire guest operating system - which may weigh 10s of GB.
Virtual Machines
The Docker Engine container comprises just the application and its dependencies. It runs as an isolated process in userspace on the host operating system, sharing the kernel with other containers. Thus, it enjoys the resource isolation and allocation benefits of VMs but is much more portable and efficient.
Docker
![Page 21: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/21.jpg)
Docker container Virtual Machine
The host kernel is shared between multiple containers
Each VM Is a full machine running a full OS
Runs the host OS Can run any OS
small file Git like versions and delta
Very large fileNo version control
Fast boot upBoot in miliseconds
Slow boot timeBoot in minutes
VM vs Docker
![Page 22: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/22.jpg)
docker container Virtual Machine
Uses very small memory footprint (only what it needs)
Uses a few gigs for each VM
many containers on a single machine
Only a few VM on a single machine
Can spin multiple containers from a base image file
Uses only oneVM per VHD / VMX file
Fast boot upBoot in milliseconds
Slow boot timeBoot in minutes
VM vs docker *
![Page 23: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/23.jpg)
docker container Virtual Machine
Content Isolation Content Isolation
Process Isolation Process Isolation
VM vs docker
![Page 24: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/24.jpg)
Community
![Page 25: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/25.jpg)
Docker HubLarge CommunityVery similar to Git Hub You can find official docker images from most of the known vendors You can share commit and download docker containers
![Page 26: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/26.jpg)
Docker Hub
![Page 27: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/27.jpg)
Docker On your machine
![Page 28: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/28.jpg)
Locally Docker is running on :
Linux Docker runs natively on linux Docker-machine
Windows Boot2Docker Vagrant Docker-machine
OSXBoot2Docker VagrantDocker-machine
![Page 29: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/29.jpg)
Demo
Run docker locally Hello World
![Page 30: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/30.jpg)
Basic commands$ docker login$ docker run$ docker pull$ docker push$ docker ps $ docker ps –a$ docker images$ docker rm$ docker rmi $docker search
![Page 31: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/31.jpg)
Basic commands
pullwill pull a docker container from docker hub repository
Loginwill login or create an account in Docker HubWill prompt for password and email if available
$ docker pull busybox$ docker pull ubuntu
$ docker Login
![Page 32: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/32.jpg)
Basic commandsRun will spin a docker container on the docker host
Pushwill push a docker container to docker hub repository
$ docker run busybox echo ‘docker sdp 2015’$ docker run -it ubuntu /bin/bash
$ docker pull <username>/busybox$ docker pull <username>/ubuntu
![Page 33: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/33.jpg)
Basic commandsPSwill show all the active container processes ps –a will show all processes active and dead as well
Imageswill show all the locally available images
$ docker ps$ docker ps -a
$ docker images
![Page 34: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/34.jpg)
Basic commandsrmwill remove a containerrmi Will delete an image
searchwill search for containers in the docker hub repository
$ docker rm <container name/id>
$ docker rmi <image name/id>
$ docker search <text>
![Page 35: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/35.jpg)
Run docker on your favorite cloud Docker can run on most of the popular cloud platforms, and it keeps spreading out
Microsoft AzureAmazon EC2Google Cloud PlatformRackspace CloudIBM SoftLayer cloudJoyent Public Cloud
![Page 36: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/36.jpg)
Docker On
Azure
![Page 37: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/37.jpg)
Docker in Azure Microsoft MS OpenTech worked together with docker to bring docker to azure You can spin a docker host machine using
Azure preview portal Azure CLI
Now just connect to your docker machine and start spinning up containers Its that simple
![Page 38: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/38.jpg)
Demo
Run docker on azureHello World
![Page 39: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/39.jpg)
What about Windows
Containers?
![Page 40: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/40.jpg)
Windows & DockerOn the last build Microsoft announced that windows 10 will support and run docker natively
To do that Microsoft changes the way windows kernel will work to allow sandboxing and isolation
We will soon see the .Net Core running inside docker container We will soon see windows servers inside docker containers as well
![Page 41: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/41.jpg)
Docker
Machine
![Page 42: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/42.jpg)
Docker MachineRun docker anywhere Setup a docker host machine on your
PCMacLinuxDatacenterCloud
Similar to Boot2docker & Vagrant
![Page 43: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/43.jpg)
DockerFiles
![Page 44: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/44.jpg)
Why do we need docker files?Docker files defines the build process of a docker container, We can set the steps we want to run inside our container to get everything we need to be installed before we deploy our code to the container, what will run in our container and how. Docker files are used to automate the docker container building process.When we want to use a container we can look at the Docker file of it and see exactly what is it made of
![Page 45: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/45.jpg)
Simple apache server example FROM ubuntu:14.04RUN \ apt-get update && \ apt-get -y install apache2
ADD index.html /var/www/html/index.html
EXPOSE 80
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
![Page 46: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/46.jpg)
Docker
Compose
![Page 47: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/47.jpg)
Fig == Docker ComposeFigDocker Compose Help us run multiple docker containers from script Similar to Chef and Puppet
Define containerslinking between containers Expose ports
![Page 48: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/48.jpg)
Docker compose YML file nginx: image: nginx links: - tomcatapp1:tomcatapp1 - tomcatapp2:tomcatapp2 - tomcatapp3:tomcatapp3 ports: - "80:80" volumes: - nginx.conf:/etc/nginx/nginx.conftomcatapp1: image: tomcat volumes: - /webapp/sample.war:/usr/local/tomcat/webapps/sample.wartomcatapp2: image: tomcat volumes: - /webapp/sample.war:/usr/local/tomcat/webapps/sample.wartomcatapp3: image: tomcat volumes: - /webapp/sample.war:/usr/local/tomcat/webapps/sample.war
![Page 49: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/49.jpg)
DockerSwarm
![Page 50: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/50.jpg)
Docker swarm Docker cluster orchestration
Swarm is a simple way to setup and deploy docker containers on multiple serversSwarm will handle all the discovery and ports for you Swarm will monitor the available recourses on your servers to find the best server to install on Swarm can also work with constraints to simplify rules on deployment
![Page 51: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/51.jpg)
SummaryDocker is changing the DevOps worldWe are on a beginning of a new era Containers will probably replace virtual machines The way we deploy code to server is changing dramatically
![Page 52: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/52.jpg)
Questions
![Page 53: Docker - SELA SDP 2015](https://reader036.vdocuments.mx/reader036/viewer/2022081506/55c8bdccbb61eb5c278b45c2/html5/thumbnails/53.jpg)
© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
SELA DEVELOPER PRACTICEMay 31 – June 4 , 2015
Rotem OrConsultant/Architect, Sela Group
Thank You!http://blogs.microsoft.co.il/rotemor/