Last active
March 24, 2021 10:16
-
-
Save mjclemente/4de6d89f6413ca333757df8ffc0420a1 to your computer and use it in GitHub Desktop.
Create Docker Hosts on DigitalOcean with Docker Machine
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 | |
#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