Last active
March 19, 2021 15:30
-
-
Save mjclemente/ada1a591bce5f4fedcd6d6d992d95705 to your computer and use it in GitHub Desktop.
Create Docker Hosts on DigitalOcean with doctl
This file contains 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 | |
#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