$linuxjunkies
>

doctl(1)

doctl is the command-line interface for DigitalOcean's cloud platform, managing droplets, databases, Kubernetes clusters, and other cloud resources.

UbuntuDebianFedoraArch

Synopsis

doctl [COMMAND] [SUBCOMMAND] [FLAGS]

Description

doctl is the official command-line tool for interacting with DigitalOcean's API. It allows you to create and manage virtual machines (droplets), block storage, databases, Kubernetes clusters, networking resources, and more directly from your terminal.

Authentication requires a DigitalOcean API token, typically stored via doctl auth init. Most operations support output in JSON, YAML, or tabular format, and can target specific regions or resource IDs.

Common options

FlagWhat it does
--help, -hdisplay help information for command or subcommand
--output, -ooutput format: text (default), json, or yaml
--formatcomma-separated list of columns to display in text output
--no-headeromit column headers from output
--sortcolumn to sort results by
--contextauthentication context to use (default is 'default')
--verbose, -venable verbose output for debugging
--access-tokenDigitalOcean API token (overrides stored configuration)

Examples

interactively configure doctl with your DigitalOcean API token

doctl auth init

list all droplets with custom columns showing name, status, memory, and region

doctl compute droplet list --format Name,Status,Memory,Region

create a new Ubuntu 20.04 droplet in New York region with 512MB memory

doctl compute droplet create my-droplet --region nyc3 --size s-1vcpu-512mb-10gb --image ubuntu-20-04-x64

permanently delete the droplet with ID 12345678 without confirmation

doctl compute droplet delete 12345678 --force

list all Kubernetes clusters in JSON format and extract cluster names

doctl kubernetes cluster list -o json | jq '.[] | .name'

display all managed databases with their engine type and current status

doctl database list --format Name,Engine,Status

upload your public SSH key to DigitalOcean for droplet access

doctl compute ssh-key create --public-key-path ~/.ssh/id_rsa.pub my-ssh-key

power on a droplet by its ID

doctl compute droplet-action power-on 12345678

Related commands