Created
April 2, 2019 15:06
-
-
Save vitor-caetano/af4706a046efbd9e8a995f084de0b2cf to your computer and use it in GitHub Desktop.
Docker Machine with versioned boot2docker
This file contains hidden or 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
#!/usr/bin/env bash | |
if [[ "$(uname -s )" == "Linux" ]]; then | |
export VIRTUALBOX_SHARE_FOLDER="$PWD:$PWD" | |
fi | |
for i in 1 2 3; do | |
docker-machine create \ | |
-d virtualbox \ | |
--virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v17.04.0-ce/boot2docker.iso \ | |
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 | |
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