Skip to content

Instantly share code, notes, and snippets.

@iffy
Created March 2, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iffy/2729ee62104fe6712ed8 to your computer and use it in GitHub Desktop.
Save iffy/2729ee62104fe6712ed8 to your computer and use it in GitHub Desktop.
# Create the cluster token
docker-machine create -d virtualbox first-machine
$(docker-machine env first-machine)
export TOKEN=$(docker run swarm create)
# Create a master
MASTER_NAME="swarm-master"
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery token://${TOKEN} ${MASTER_NAME}
# Create some nodes
for i in 0 1; do
echo $i
docker-machine create -d virtualbox --swarm --swarm-discovery token://${TOKEN} swarm-node-${i}
done
docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
first-machine virtualbox Running tcp://192.168.99.103:2376
swarm-master virtualbox Running tcp://192.168.99.104:2376 swarm-master (master)
swarm-node-0 virtualbox Running tcp://192.168.99.111:2376
swarm-node-1 * virtualbox Running tcp://192.168.99.112:2376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment