Docker Machine & Docker Swarm

Post on 16-Apr-2017

1,081 views 8 download

transcript

Docker Machine & Swarm

Gustavo Dacunda – Guillermo Lucero

• Docker Machine• Providers & OS• Demo• Container manageability today• Manageability with Docker Swarm• Swarm in a nutshell• Docker Swarm architecture• Setup using the hosted discovery service• Swarm Scheduler• Constraints• Affinities• Demo

Agenda

Docker Machine Docker Client Docker Machine Docker Compose (Mac only) Docker Kitematic VirtualBoxDocker Toolbox

$ docker-machine create --driver [Provider] dev

Remote Provider

Local Provider

Providers & Distributions

Boot2Docker 1.5+

Ubuntu 12.04+

RancherOS 0.3+

Debian 8.0+

RedHat Enterprise Linux 7.0+

CentOS 7+

Fedora 21+

Today

tcp://host:2375 tcp://host:2375tcp://host:2375

With Docker Swarm

......

Swarm Manager

tcp://host:2375

tcp://host:2375 tcp://host:2375tcp://host:2375

Swarm in a nutshell

Exposes several Docker Engines as a single virtual Engine

Serves the standard Docker API

Extremely easy to get started

Batteries included but swappable

Swarm Manager

Token service

tcp://host:2375

Docker Swarm Architecture

......tcp://

host:2375tcp://

host:2375tcp://

host:2375

Service Discovery Scheduler

Create a cluster$ swarm create

Add nodes to a cluster$ swarm join –add=<node_ip> token://<token>

Start Swarm$ swarm manage –addr=<swarm_ip> token://<token>

Or you can use your own etcd, zookeeper or consul

Setup using the hosted discovery service

Swarm Scheduler

Scheduler strategies Spread Binpack Random

Scheduler filters Constraint Affinity Port Dependency Health

Constraints

Standard constraints induced from Docker infodocker run –e "constraint:operatingsystem==*fedora*"docker run –e "constraint:storagedriver==*aufs*"

Custom constraints with host labelsdocker –d –label "region==us-east"docker run –e "constraint:region==us-east"

Pin a container to a specific hostdocker run –e "constraint:node==Ubuntu-2"

Containers affinitiesdocker run –name web nginxdocker run –e "affinity:container==web" logger

Containers Anti-affinitiesdocker run –name redis-master redisdocker run –name redis-slave –e "affinity:container!=redis*"

Images affinitiesdocker run –e "affinity:image==redis" redis

Affinities

Demo