Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create Docker Hosts on DigitalOcean with Docker Machine
#!/bin/bash
#Based on: https://github.com/BretFisher/dogvscat/blob/master/create-servers.sh
#For more details, see: https://blog.mattclemente.com/2018/07/15/create-docker-nodes-on-digitalocean-with-shell-script.html
#Approach without Docker Machine: https://gist.github.com/mjclemente/ada1a591bce5f4fedcd6d6d992d95705
args=(
--driver=digitalocean
--digitalocean-access-token="${DO_TOKEN}"
--digitalocean-ssh-key-fingerprint="${SSH_FINGERPRINT}"
--digitalocean-private-networking=true
--digitalocean-tags=demotag
)
if [[ -n "${DO_SIZE}" ]]; then
args+=( --digitalocean-size="${DO_SIZE}" )
fi
if [[ -n "${DO_IMAGE}" ]]; then
args+=( --digitalocean-image="${DO_IMAGE}" )
fi
if [[ -n "${DO_REGION}" ]]; then
args+=( --digitalocean-region="${DO_REGION}" )
fi
for server in {1..3}; do
docker-machine create "${args[@]}" \
dvc${server} &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.