All Projects → monicagangwar → docker-swarm-vagrant

monicagangwar / docker-swarm-vagrant

Licence: other
Getting started with Docker swarm

Programming Languages

HTML
75241 projects
python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to docker-swarm-vagrant

Docker Windows Box
Various Vagrant envs with Windows 2019/10 and Docker, Swarm mode, LCOW, WSL2, ...
Stars: ✭ 487 (+2335%)
Mutual labels:  vagrant, docker-swarm
docker-volume-hetzner
Docker Volume Plugin for accessing Hetzner Cloud Volumes
Stars: ✭ 81 (+305%)
Mutual labels:  cluster, docker-swarm
Kubernetes Vagrant Coreos Cluster
Kubernetes cluster (for testing purposes) made easy with Vagrant and CoreOS.
Stars: ✭ 598 (+2890%)
Mutual labels:  vagrant, cluster
Docker Swarm
🐳🐳🐳 This repository is part of a blog series on Docker Swarm example using VirtualBox, OVH Openstack, Azure and Amazon Web Services AWS
Stars: ✭ 43 (+115%)
Mutual labels:  cluster, docker-swarm
kubernetes the easy way
Automating Kubernetes the hard way with Vagrant and scripts
Stars: ✭ 22 (+10%)
Mutual labels:  vagrant, cluster
Miniswarm
Docker Swarm cluster in one command
Stars: ✭ 130 (+550%)
Mutual labels:  cluster, docker-swarm
K8s Vagrant Multi Node
A Kubernetes Vagrant Multi node environment using kubeadm.
Stars: ✭ 141 (+605%)
Mutual labels:  vagrant, cluster
Ansible Windows Docker Springboot
Example project showing how to provision, deploy, run & orchestrate Spring Boot apps with Docker Windows Containers on Docker Windows native using Packer, Powershell, Vagrant & Ansible
Stars: ✭ 58 (+190%)
Mutual labels:  vagrant, docker-swarm
kubernetes-basico
Demonstração dos componentes do Kubernetes
Stars: ✭ 26 (+30%)
Mutual labels:  vagrant, cluster
hivemq4-docker-images
Official Docker Images for the Enterprise MQTT Broker HiveMQ
Stars: ✭ 18 (-10%)
Mutual labels:  cluster, docker-swarm
Jaas
Run jobs (tasks/one-shot containers) with Docker
Stars: ✭ 291 (+1355%)
Mutual labels:  cluster, docker-swarm
dockerX
Examples of amazing Docker/Docker-Compose/Docker Swarm technologies
Stars: ✭ 17 (-15%)
Mutual labels:  vagrant, docker-swarm
aws docker swarm
setup to bootstrap docker swarm cluster and a controller on AWS using terraform
Stars: ✭ 24 (+20%)
Mutual labels:  cluster, docker-swarm
Tads Boilerplate
Terraform + Ansible + Docker Swarm boilerplate = DevOps on 🔥🔥🔥 | Infrastructure as Code
Stars: ✭ 424 (+2020%)
Mutual labels:  vagrant, docker-swarm
vagrant-boot2docker-swarm
A multi-machine Docker swarm Vagrant environment
Stars: ✭ 16 (-20%)
Mutual labels:  vagrant, docker-swarm
clusterplex
ClusterPlex is basically an extended version of Plex, which supports distributed Workers across a cluster to handle transcoding requests.
Stars: ✭ 123 (+515%)
Mutual labels:  cluster, docker-swarm
fastdata-cluster
Fast Data Cluster (Apache Cassandra, Kafka, Spark, Flink, YARN and HDFS with Vagrant and VirtualBox)
Stars: ✭ 20 (+0%)
Mutual labels:  vagrant, cluster
saltstack-kubernetes
Deploy the lowest-cost production ready Kubernetes cluster using terraform and saltstack.
Stars: ✭ 47 (+135%)
Mutual labels:  cluster
ants
Awesome Networking Tools Sandbox
Stars: ✭ 21 (+5%)
Mutual labels:  vagrant
vagrant-puppetmaster
A simple vagrant setup exposing all permutations of puppetmaster roles
Stars: ✭ 19 (-5%)
Mutual labels:  vagrant

Docker Swarm

Sample 3 node Vagrant setup for getting started with Docker swarm

ezgif-1-66e3c945a9

watch whole demo here

Installation

Install Vagrant Binary from here
Download ubuntu/trusty64 box from vagrant using the command vagrant box add ubuntu/trusty64
Clone this repo

git clone https://github.com/monicagangwar/docker-swarm-vagrant.git  
cd docker-swarm-vagrant  

Initialize VMs

Run vagrant up

  • This will set up 3 VMs - manager, worker-1 & worker-2 all provisioned with docker
  • manager node also has Flask app image monicagangwar/docker-swarm-vagrant installed on it.
    Which can be run as docker run -p 8000:8000 --name dsv monicagangwar/docker-swarm-vagrant

To ssh into the manager node run vagrant ssh manager
To ssh into worker node run vagrant ssh worker-1 or vagrant ssh worker-2

Initialize Swarm manager

  • ssh into manager node
  • run docker swarm init --advertise-addr <manager-IP-address>:2377
    IP address is of the Manager Virtual Machine. Can be found / setup in Vagrantfile
    Port 2377 is default for swarm
    This will generate a command with a token value docker swarm join --token <token> <manager-IP-address>:2377
  • ssh into the worker nodes and execute the command generated above
  • run docker node ls on the manager node to see the list of nodes and their roles(worker/manager)
  • run docker network create -d overlay <network-name>
    creates an overlay network with the name specified which each of the container can join
    random-network will be the overlay network that our application containers live on
    -d tells which driver to use. Currently overlay driver is being used
  • run docker service create --name <service-name> --network <network-name> <image-name>
    Creates the service with the given service name on the network specified. This will basically run containers from the image name specified on the nodes connected to the swarm.

Scale up and down

  • Scale up : docker service update --replicas 7 <service-name>
    Replicates the container 7 times and balances into all available nodes based on a round-robin or any such algorithms. This will launch arbitrary number of containers in each node (including manager)
    Check which container is running on which node by running docker service ps <service-name>
    Check how many containers are running on the current node by running docker ps or docker container ls

  • Scale down : docker service update --replicas 4 <service-name> This command will destroy some of the containers on some of the nodes. Check which containers got destroyed by using the commands specified above.

Manage worker nodes

  • Drain : Bring a node down for management purpose
    docker node update --availability drain <worker-node-id>
    can be found by running docker node ls
    This will destroy the containers on the specified worker node and will relaunch them on available nodes

  • Active : Bring up a node drained for management purpose
    docker node update --availability active <worker-node-id>
    This will activate the drained node and will deploy further scaled up containers on this as well

Helper commands

  • docker service ls
    Lists the services created
  • docker network ls
    Lists the networks created and available by default
  • docker node ls
    Lists all the nodes in swarm
  • docker service ps <service-name>
    Lists all the containers running in all swarm nodes.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].