Created
January 8, 2016 11:30
-
-
Save binarytemple/861c2ae8a7d9bf0f5b62 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| ######################################################### | |
| # Check first to ensure the docker machines - | |
| # local and swarm-master don't already exist on the sytem | |
| docker-machine ls | sed -ne '/NAME/!{s/[ ].*//;p;}' | egrep "(local|swarm-master)" > /dev/null | |
| if [ $? == 0 ]; | |
| then echo "machines name swarm-master or local already exist on this sytem" | |
| exit 1 | |
| fi | |
| docker-machine create -d vmwarefusion local | |
| eval "$(docker-machine env local)" | |
| SWARM_TOKEN=$(docker run swarm create | tail -n1) | |
| echo "Generated swarm token : ${SWARM_TOKEN}" | |
| echo "#$(date) - ${SWARM_TOKEN}" >> ~/.swarm_tokens | |
| echo "${SWARM_TOKEN}" >> ~/.swarm_tokens | |
| echo "Creating swarm master: ${SWARM_TOKEN}" | |
| docker-machine create \ | |
| -d vmwarefusion \ | |
| --swarm \ | |
| --swarm-master \ | |
| --swarm-discovery "token://${SWARM_TOKEN}" \ | |
| --engine-storage-driver=devicemapper \ | |
| swarm-master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment