Skip to content

Instantly share code, notes, and snippets.

@batmat
Created December 7, 2015 20:20
Show Gist options
  • Save batmat/feb0c125bff6f770d91f to your computer and use it in GitHub Desktop.
Save batmat/feb0c125bff6f770d91f to your computer and use it in GitHub Desktop.
Simple docker swarm creation script
#!/bin/bash
NODECOUNT=2
SWARM_DISCOVERY="token://$(docker run --rm swarm create)"
DRIVER="--driver digitalocean --digitalocean-access-token="$(cat ~/.docker/digitaloceantoken)
#DRIVER="--driver virtualbox"
#DIGITALOCEAN_SIZE=64gb
docker-machine create \
$DRIVER \
--swarm \
--swarm-master \
--swarm-strategy "binpack" \
--swarm-discovery "$SWARM_DISCOVERY" \
swarm-master
for nodeNumber in $(seq -w 1 $NODECOUNT)
do
docker-machine create \
$DRIVER \
--swarm \
--swarm-discovery "$SWARM_DISCOVERY" \
swarm-node-$nodeNumber
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment