Created
March 16, 2017 04:14
-
-
Save watsh-rajneesh/408f4cebb3c10c28bccb923fb9fbb2cb to your computer and use it in GitHub Desktop.
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
for i in 1 2 3; do | |
docker-machine create \ | |
-d virtualbox \ | |
swarm-$i | |
done | |
eval $(docker-machine env swarm-1) | |
docker swarm init \ | |
--advertise-addr $(docker-machine ip swarm-1) | |
TOKEN=$(docker swarm join-token -q manager) | |
for i in 2 3; do | |
eval $(docker-machine env swarm-$i) | |
docker swarm join \ | |
--token $TOKEN \ | |
--advertise-addr $(docker-machine ip swarm-$i) \ | |
$(docker-machine ip swarm-1):2377 | |
done | |
for i in 1 2 3; do | |
eval $(docker-machine env swarm-$i) | |
docker node update \ | |
--label-add env=prod \ | |
swarm-$i | |
done | |
echo ">> The swarm cluster is up and running" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment