Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create Docker Hosts on DigitalOcean with doctl
#!/bin/bash
#For more details, see: https://blog.mattclemente.com/2019/03/04/script-docker-host-creation-digitalocean-doctl.html
DO_DROPLET_NAME=docker-node
DO_SIZE=s-1vcpu-1gb
DO_REGION=nyc1
DO_SSH_IDS=$(doctl compute ssh-key list --no-header --format ID)
DO_TAGS=demotag
DO_DROPLET_COUNT=3
: "${DO_SSH_IDS:?Please set your DO_SSH_IDS}"
for server in {1..$DO_DROPLET_COUNT}; do
doctl compute droplet create $DO_DROPLET_NAME-${server} --size $DO_SIZE --image docker-18-04 --region $DO_REGION --ssh-keys $DO_SSH_IDS --tag-names $DO_TAGS --enable-backups --enable-monitoring --enable-private-networking --wait
done
unset DO_DROPLET_NAME
unset DO_SIZE
unset DO_REGION
unset DO_SSH_IDS
unset DO_TAGS
unset DO_DROPLET_COUNT
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.