Created
December 23, 2015 06:16
-
-
Save prologic/b906774dd5ae2c3617d9 to your computer and use it in GitHub Desktop.
bash script to create docker swarm cluster with docker machine and virtualbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script para generar entorno simulado de cluster Swarm con 3 nodos | |
# Creación de maquina default (se utilizara como cliente ) | |
# docker-machine create -d virtualbox default | |
# eval $(docker-machine env default) | |
# Lanzamos swarm desde maquina default | |
SWARM_TOKEN=$(docker run swarm create) | |
echo "SWARM_TOKEN: $SWARM_TOKEN" >> swarm_token.txt | |
# Creación de maquina Swarm Master | |
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery token://$SWARM_TOKEN swarm-master | |
docker-machine ls | |
# Creación de Nodos | |
docker-machine create -d virtualbox --swarm --swarm-discovery token://$SWARM_TOKEN swarm-agent-00 | |
docker-machine create -d virtualbox --swarm --swarm-discovery token://$SWARM_TOKEN swarm-agent-01 | |
docker-machine create -d virtualbox --swarm --swarm-discovery token://$SWARM_TOKEN swarm-agent-02 | |
docker-machine ls | |
# Apuntar consola a Docker en Swarm Master | |
# Point your Docker environment to the machine running the swarm master | |
eval $(docker-machine env --swarm swarm-master) | |
# Listamos nodos activos | |
docker run -rm swarm list token://$SWARM_TOKEN | |
echo "SWARM_TOKEN: $SWARM_TOKEN" | |
docker info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment