GithubHelp home page GithubHelp logo

docker-swarm-presentation's Introduction

Docker Swarm Presentation

Presentation

Slides

Building a docker swarm cluster

for i in 1 2 3; do
    docker-machine create -d virtualbox swarm-$i
done

Checking my machines

docker-machine ls

The output is

NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
swarm-1   -        virtualbox   Running   tcp://192.168.99.100:2376           v1.13.0
swarm-2   -        virtualbox   Running   tcp://192.168.99.101:2376           v1.13.0
swarm-3   -        virtualbox   Running   tcp://192.168.99.102:2376           v1.13.0

Creating the cluster

eval "$(docker-machine env swarm-1)"

docker swarm init --advertise-addr $(docker-machine ip swarm-1)

Adding the visualizer service

eval "$(docker-machine env swarm-1)"
docker service create \
  --name=visualizer \
  --publish=8000:8080/tcp \
  --constraint=node.role==manager \
  --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  dockersamples/visualizer

open http://$(docker-machine ip swarm-1):8000

Adding workers to the cluster

eval "$(docker-machine env swarm-1)"
JOIN_TOKEN=$(docker swarm join-token -q worker)

for i in 2 3; do
    eval "$(docker-machine env swarm-$i)"

    docker swarm join --token $JOIN_TOKEN \
        --advertise-addr $(docker-machine ip swarm-$i) \
        $(docker-machine ip swarm-1):2377
done
eval "$(docker-machine env swarm-1)"
docker node ls

Creating network

eval "$(docker-machine env swarm-1)"
docker network create -d overlay routing-mesh

Deploy a new service

eval "$(docker-machine env swarm-1)"
docker service create \
  --name=docker-routing-mesh \
  --publish=8080:8080/tcp \
  --network routing-mesh \
  --reserve-memory 20m \
  albertogviana/docker-routing-mesh:1.0.0

Testing the service

curl http://$(docker-machine ip swarm-1):8080
curl http://$(docker-machine ip swarm-2):8080
curl http://$(docker-machine ip swarm-3):8080

Scaling a service

docker service scale docker-routing-mesh=3

Calling a service

while true; do curl http://$(docker-machine ip swarm-1):8080; sleep 1; echo "\n";  done

Rolling updates

eval "$(docker-machine env swarm-1)"
docker service update \
  --update-failure-action pause \
  --update-parallelism 1 \
  --image albertogviana/docker-routing-mesh:2.0.0 \
  docker-routing-mesh

Calling a service

while true; do curl http://$(docker-machine ip swarm-1):8080/health; sleep 1; echo "\n";  done

Docker secret create

echo test | docker secret create my_secret -

Docker secret ls

docker secret ls

Deploy my secret

eval "$(docker-machine env swarm-1)"
docker service update \
  --update-failure-action pause \
  --update-parallelism 1 \
  --secret-add my_secret \
  --image albertogviana/docker-routing-mesh:2.0.0 \
  docker-routing-mesh

Drain a node

docker node update --availability=drain swarm-3

Listing nodes

docker node ls

Bring the node back

docker node update --availability=active swarm-3

Docker system info

docker system info

Docker and disk?

docker system df

Docker clean up

docker system prune

docker-swarm-presentation's People

Contributors

albertogviana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.