Skip to content

Instantly share code, notes, and snippets.

@zeddee
Last active September 10, 2019 11:11
Show Gist options
  • Save zeddee/860a6e484da72003738c992a3553b554 to your computer and use it in GitHub Desktop.
Save zeddee/860a6e484da72003738c992a3553b554 to your computer and use it in GitHub Desktop.

Using the doctl CLI tool

Install and use the doctl tool to manage Digital Ocean droplets.

Sample script to start up a DO droplet for running Lighthouse:

doctl compute droplet create lighthouse-runner \
  --size s-1vcpu-1gb \
  --region sgp1 \
  --image ubuntu-19-04-x64 \
  --ssh-keys "e8:24:66:af:01:e5:2b:69:95:be:27:28:21:15:8b:c8"

NOTE: If you don't provide an SSH key when creating a droplet, you'll need to go onto Digital Ocean to reset your droplet's password. Look for the Reset Root Password button under Access.

To get list of available:

Sizes: doctl compute size list
Regions: doctl compute region list
Images: doctl compute image list-distribution
SSH keys: doctl compute ssh-key list (use fingerprint)

Get IP address of droplet: doctl compute droplet get <droplet_ID> --format PublicIPv4 --no-header

To start a Digital Ocean Docker droplet (tho you should be using at least 2gb):

doctl compute droplet create \
  --size s-1vcpu-1gb \
  --region sgp1 \
  --image docker-18-04 \
  --ssh-keys "e8:24:66:af:01:e5:2b:69:95:be:27:28:21:15:8b:c8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment