docker - sela sdp 2015

Post on 10-Aug-2015

122 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© 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

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

History of docker

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

A few month later This little side project became huge

160 contributors 4000 GitHub stars 1000+ tickets 250 pull request

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

What is

Docker?

Questions

The ProblemShipping code to server a few years ago

The ProblemShipping code to server today

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

The matrix from hell

Similar problem The shipping Industry

It kind of looks like this

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

? ? ? ? ? ?

Another matrix from hell

The Solution

No need for the Matrix

The Solution

Virtual Machine

VSDocker

Containers

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

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

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 *

docker container Virtual Machine

Content Isolation Content Isolation

Process Isolation Process Isolation

VM vs docker

Community

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

Docker Hub

Docker On your machine

Locally Docker is running on :

Linux Docker runs natively on linux Docker-machine

Windows Boot2Docker Vagrant Docker-machine

OSXBoot2Docker VagrantDocker-machine

Demo

Run docker locally Hello World

Basic commands$ docker login$ docker run$ docker pull$ docker push$ docker ps $ docker ps –a$ docker images$ docker rm$ docker rmi $docker search

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

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

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

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>

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

Docker On

Azure

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

Demo

Run docker on azureHello World

What about Windows

Containers?

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

Docker

Machine

Docker MachineRun docker anywhere Setup a docker host machine on your

PCMacLinuxDatacenterCloud

Similar to Boot2docker & Vagrant

DockerFiles

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

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"]

Docker

Compose

Fig == Docker ComposeFigDocker Compose Help us run multiple docker containers from script Similar to Chef and Puppet

Define containerslinking between containers Expose ports

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

DockerSwarm

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

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

Questions

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

top related