container (docker) orchestration tools

25
Docker Container Orchestration @dhilipsiva Tech Lead, Full-Stack & DevOps - @Appknox http://dhilipsiva.com [email protected]

Upload: dhilipsiva-

Post on 21-Jan-2017

200 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: Container (Docker) Orchestration Tools

Docker ContainerOrchestration

@dhilipsiva

Tech Lead, Full-Stack & DevOps - @Appknox http://dhilipsiva.com [email protected]

Page 2: Container (Docker) Orchestration Tools

Container DevelopersMeetup Bangalore

Meetup #3 - Dockerizing Applications

Docker Orchestration tools

https://www.meetup.com/Container-Developers-Meetup-Bangalore/events/233529360/

Page 3: Container (Docker) Orchestration Tools

@dhilipsivaTech Lead, Full-Stack & DevOps - @Appknox

I code for Web, Mobile, Embedded & IoT. Open-Source Fanatic. Big Data & Machine LearningEnthusiast. Dad. Atheist

So primarily a Developer + little bit of this & that

Jack of all trades & Master of none

Page 4: Container (Docker) Orchestration Tools

I have no idea what I amtalking about

If you think that I got something wrong, then Iprobably am. So please feel free to correct me

After all, it is the mistakes and the lessons welearn from it - are the very things that de�ne us

Constructive criticism is more than welcomed!

Page 5: Container (Docker) Orchestration Tools

Orchestration

Page 6: Container (Docker) Orchestration Tools

Orchestration (computing)Orchestration is the automated arrangement,coordination, and management of computer systems,middleware, and services (From Wikipedia)

Process Discovery

Scheduling

Cluster Management

Uni�ed way of installing backing services

Easy way to Update / rollback applications

Etc,.

Page 8: Container (Docker) Orchestration Tools

KubernetesThere is a detailed Hands-On sessions onKubernetes this Afternoon

Docker Basics is an absolute requirement.

If you are not comfortable with Basics of Docker,please attend Anand Gothe's Docker by exampleSession

Page 9: Container (Docker) Orchestration Tools

MarathonApache Mesos (Or on Mesoshpere's DCOS)

Apache Zookeeper

Install Marathon on the Cluster

Create marathon-demo.json �le

run curl -X POST http://marthon-master:PORT/v2/apps [email protected] -H "Content-type:application/json"

Page 10: Container (Docker) Orchestration Tools

basic-3.json

{ "id": "marathon-demo", "cmd": "python3 -m http.server 8080", "cpus": 0.5, "mem": 32.0, "container": { "type": "DOCKER", "docker": { "image": "python:3", "network": "BRIDGE", "portMappings": [ { "containerPort": 8080, "hostPort": 0 } ] } } }

Page 11: Container (Docker) Orchestration Tools
Page 12: Container (Docker) Orchestration Tools
Page 13: Container (Docker) Orchestration Tools

RancherMostly GUI Based

You can experiment with it yourself by pulling theDocker Image & running it: docker run -d --restart=always -p 8080:8080rancher/server

Page 14: Container (Docker) Orchestration Tools

HeliosInstallation

# install helios-solo on Debian/Ubuntu $ curl -sSL https://spotify.github.io/helios-apt/go | sudo sh -$ sudo apt-get install helios-solo # install helios-solo on OS X $ brew tap spotify/public && brew install helios-solo # launch a helios cluster in a Docker container $ helios-up # check if it worked and the solo agent is registered $ helios-solo hosts

Page 15: Container (Docker) Orchestration Tools

# Create an nginx job using the nginx container image, # exposing it on the host on port 8080 $ helios create nginx:v1 nginx:1.7.1 -p http=80:8080 # Check that the job is listed $ helios jobs # List helios hosts $ helios hosts # Deploy the nginx job on one of the hosts $ helios deploy nginx:v1 <host> # Check the job status $ helios status # Curl the nginx container when it's started running $ curl <host>:8080 # Undeploy the nginx job $ helios undeploy -a nginx:v1 # Remove the nginx job $ helios remove nginx:v1

Page 16: Container (Docker) Orchestration Tools

Ansible Container$ [sudo] pip install ansible-container $ ansible-container init $ ansible-container build $ ansible-container run $ ansible-container push $ ansible-container shipit

Page 17: Container (Docker) Orchestration Tools

Swarm & SwarmKitBoth are very similar

Swarm is stand-alone

SwarmKit comes with Docker 1.12 (Swarm Mode)

# Creating a service $ swarmctl service create --name redis --image redis:3.0.5 $ swarmctl service ls $ swarmctl service inspect redis $ swarmctl service update redis --replicas 6 $ swarmctl service update redis --image redis:3.0.6 # Rolling update $ swarmctl service update redis --image redis:3.0.7 --update

Page 18: Container (Docker) Orchestration Tools

Shippershipper is a fabric for docker - tool for orchestratingdocker containers. Supports parallel execution andcan generate command line interface

from shipper import Shipper, run, command @command def build(tag, path): s = Shipper() s.build(tag=tag, path=path) @command def ps(all=False, running=True): s = Shipper(["host-a", "host-b"]) print s.containers(pretty=True, all=all, running=running)

Page 19: Container (Docker) Orchestration Tools

@command def start(image, command, ports=None): if ports: ports = ports.split(",") s = Shipper() s.run(image, command, ports=ports, once=True) @command def stop(image=None): s = Shipper() s.stop(*s.containers(image=image, running=True)) run()

$ python env.py ps --all $ python env.py build base ~/images/base $ python env.py build stop --image dev/.*

Page 20: Container (Docker) Orchestration Tools

Maestrotemplates: nodejs: config: command: /usr/bin/node /var/www/app.js ports: - '80' environment: - PORT=80 buildspec: url: github.com/toscanini/docker-nodejs require: mongodb: port: '27017' mongodb: config: command: /usr/bin/mongod --config /etc/mongodb.conf buildspec: url: github.com/toscanini/docker-mongodb

Page 21: Container (Docker) Orchestration Tools

Maestro provides the ability to easily launch,orchestrate and manage mulitple Docker containersas single unit.

maestro build maestro start [node_name] maestro stop [node_name] maestro run template [commandline] maestro ps maestro destroy

Page 22: Container (Docker) Orchestration Tools

AzkUse azk and easily orchestrate developmentenvironments on your own machine and then justcode.

$ brew install azukiapp/azk/azk $ azk agent start $ azk init $ azk start -vv $ azk status # Access http://azkdemo.dev.azk.io

Page 23: Container (Docker) Orchestration Tools

/** * Documentation: http://docs.azk.io/Azkfile.js */ // Adds the systems that shape your system systems({ azkdemo: { // Dependent systems depends: [], // More images: http://images.azk.io image: {"docker": "azukiapp/node:0.12"}, // Steps to execute before running instances provision: [ "npm install", ], workdir: "/azk/#{manifest.dir}", shell: "/bin/bash", command: ["npm", "start"], wait: {"retry": 20, "timeout": 1000}, mounts: { '/azk/#{manifest.dir}': path("."), '/azk/#{manifest.dir}/node_modules': persistent("node-modules-#{system.name}"