docker - sela sdp 2015

53
© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com SELA DEVELOPER PRACTICE May 31 – June 4 , 2015 Rotem Or Consultant/Architect, Sela Group

Upload: rotem-or

Post on 10-Aug-2015

121 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Docker  - SELA SDP 2015

© 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

AgendaHistoryWhat is DockerVirtual machines vs. ContainersCommunity Run docker locallyRun docker on azureDocker machineDocker FilesDocker ComposeDocker Swarm

Page 3: Docker  - SELA SDP 2015

History of docker

Page 4: Docker  - SELA SDP 2015

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

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

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

What is

Docker?

Page 8: Docker  - SELA SDP 2015

Questions

Page 9: Docker  - SELA SDP 2015

The ProblemShipping code to server a few years ago

Page 10: Docker  - SELA SDP 2015

The ProblemShipping code to server today

Page 11: Docker  - SELA SDP 2015

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

The matrix from hell

Page 13: Docker  - SELA SDP 2015

Similar problem The shipping Industry

Page 14: Docker  - SELA SDP 2015

It kind of looks like this

Page 15: Docker  - SELA SDP 2015

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

Another matrix from hell

Page 16: Docker  - SELA SDP 2015

The Solution

Page 17: Docker  - SELA SDP 2015

No need for the Matrix

Page 18: Docker  - SELA SDP 2015

The Solution

Page 19: Docker  - SELA SDP 2015

Virtual Machine

VSDocker

Containers

Page 20: Docker  - SELA SDP 2015

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

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

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

docker container Virtual Machine

Content Isolation Content Isolation

Process Isolation Process Isolation

VM vs docker

Page 24: Docker  - SELA SDP 2015

Community

Page 25: Docker  - SELA SDP 2015

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

Docker Hub

Page 27: Docker  - SELA SDP 2015

Docker On your machine

Page 28: Docker  - SELA SDP 2015

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

Demo

Run docker locally Hello World

Page 30: Docker  - SELA SDP 2015

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

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

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

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

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

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

Docker On

Azure

Page 37: Docker  - SELA SDP 2015

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

Demo

Run docker on azureHello World

Page 39: Docker  - SELA SDP 2015

What about Windows

Containers?

Page 40: Docker  - SELA SDP 2015

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

Docker

Machine

Page 42: Docker  - SELA SDP 2015

Docker MachineRun docker anywhere Setup a docker host machine on your

PCMacLinuxDatacenterCloud

Similar to Boot2docker & Vagrant

Page 43: Docker  - SELA SDP 2015

DockerFiles

Page 44: Docker  - SELA SDP 2015

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

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

Docker

Compose

Page 47: Docker  - SELA SDP 2015

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

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

DockerSwarm

Page 50: Docker  - SELA SDP 2015

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

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

Questions

Page 53: Docker  - SELA SDP 2015

© 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/