Programmatically get the IP of your DigitalOcean Droplet

You can retrieve the IP of. your Digital Ocean Droplet using the example below.

export DOCKER_IP=`docker run --tty --env=DIGITALOCEAN_ACCESS_TOKEN=$DO_TOKEN digitalocean/doctl compute droplet list $DOCKER_NAME --format "PublicIPv4" | tail -n1 | awk '{print $1}'`

ping $DOCKER_IP -c1

If like me you use Bitbucket Pipelines you can incorporate this into your pipeline build + deploy.

 

Gareth
Buy Me A Coffee
back arrowBack to Index