doctl

official DigitalOcean command-line interface

TLDR

Authenticate with DigitalOcean
$ doctl auth init
List all droplets
$ doctl compute droplet list
Create a droplet
$ doctl compute droplet create [name] --size [s-1vcpu-1gb] --image [ubuntu-22-04-x64] --region [nyc1]
Delete a droplet
$ doctl compute droplet delete [droplet_id]
List Kubernetes clusters
$ doctl kubernetes cluster list
Get kubeconfig
$ doctl kubernetes cluster kubeconfig save [cluster_name]
List available regions
$ doctl compute region list
List all databases
$ doctl databases list
List Spaces (object storage buckets)
$ doctl spaces list
Create a container registry
$ doctl registry create [name]
List SSH keys
$ doctl compute ssh-key list
Output as JSON
$ doctl compute droplet list --output json

SYNOPSIS

doctl command [subcommand] [options]

DESCRIPTION

doctl is the official command-line interface for DigitalOcean, providing access to all DigitalOcean services including Droplets, Kubernetes, App Platform, Databases, and more.The tool enables infrastructure automation, CI/CD integration, and scriptable management of DigitalOcean resources. It supports multiple authentication contexts for managing different accounts or teams.doctl mirrors the DigitalOcean API functionality, allowing complete control over cloud resources from the command line without using the web console.

PARAMETERS

COMMAND

Resource type: account, auth, compute, apps, databases, kubernetes, monitoring, projects, registry, serverless, spaces, vpcs, etc.
auth init
Authenticate with API token.
auth list
List available authentication contexts.
compute droplet ACTION
Manage Droplets (create, list, delete, get, etc.).
compute volume ACTION
Manage block storage volumes.
compute domain ACTION
Manage DNS domains and records.
compute firewall ACTION
Manage cloud firewalls.
compute load-balancer ACTION
Manage load balancers.
kubernetes cluster ACTION
Manage Kubernetes clusters.
apps ACTION
Manage App Platform applications.
databases ACTION
Manage managed database clusters.
spaces ACTION
Manage Spaces object storage.
registry ACTION
Manage container registries.
serverless ACTION
Manage serverless functions.
monitoring ACTION
Manage monitoring alert policies and uptime checks.
projects ACTION
Organize and assign resources to projects.
--access-token TOKEN
DigitalOcean API token. Overrides config and DIGITALOCEANACCESSTOKEN.
--output FORMAT
Output format: text, json.
--format COLUMNS
Comma-separated list of columns to display in table output.
--context NAME
Use named authentication context.
--trace
Show a log of network activity while performing a command.
--verbose
Enable verbose output.
--help
Display help information.

INSTALL

sudo dnf install doctl
sudo pacman -S doctl
sudo apk add doctl
brew install doctl
nix profile install nixpkgs#doctl

CAVEATS

Requires DigitalOcean account and API token. Actions may incur charges. Some operations are irreversible. Rate limits apply to API requests.

HISTORY

doctl was developed by DigitalOcean as the official CLI for their cloud platform. It provides programmatic access to DigitalOcean services, supporting DevOps workflows and infrastructure as code practices.

SEE ALSO

kubectl(1), terraform(1), aws(1), gcloud(1)