replica-omnisciente/docs/guides/cli/doctl.md

2.6 KiB

doctl (DigitalOcean CLI)

What it is

DigitalOcean's CLI: droplets, Kubernetes (DOKS), Spaces (S3-compatible), App Platform, container registry — everything in the DO API from the shell.

Install

GitHub release binary (x86_64; use the arm64 archive on ARM):

VERSION=$(curl -fsSL https://api.github.com/repos/digitalocean/doctl/releases/latest \
  | grep -oP '"tag_name":\s*"v\K[^"]+')
curl -fsSL -o /tmp/doctl.tar.gz \
  "https://github.com/digitalocean/doctl/releases/download/v${VERSION}/doctl-${VERSION}-linux-amd64.tar.gz"
tar -xzf /tmp/doctl.tar.gz -C /tmp
sudo install /tmp/doctl /usr/local/bin/doctl

(Also available as a snap, but the static binary pins cleanly and has no snap confinement surprises.)

Authenticate

Create a personal access token in the DO dashboard (read+write), store it in Vaultwarden (https://vault.portugalfuturista.org), then:

doctl auth init                 # paste the token
doctl auth list

Config: ~/.config/doctl/config.yaml. Multiple tokens → doctl auth init --context <name> and doctl auth switch.

Configure for this environment

doctl account get
doctl compute droplet list
doctl kubernetes cluster list
doctl registry login            # docker creds for registry.digitalocean.com

Self-hosted equivalent

Our Proxmox cluster is the self-hosted DigitalOcean: droplets → VMs/CTs managed with qm/pct (via SSH on asus/gigabyte/lattepanda), Spaces → MinIO at http://192.168.0.40:9000 (S3-compatible, works with aws s3 --endpoint-url), DOKS → planned k3s (see kubectl.md). doctl is used only for resources that must live outside the lab.

Aurélio integration

The cli-devops skill can drive doctl for external VPS/registry ops. No dedicated connector-registry entry — external SaaS; the self-hosted counterparts are covered by minio and kubernetes.

Verify

doctl version
# doctl version 1.x.y-release ...
doctl account get
# Email  Droplet Limit  Email Verified  UUID  Status
# you@...  25           true            ...   active

Troubleshooting

  • 401 Unable to authenticate you — token expired/revoked; regenerate in the dashboard, update Vaultwarden, doctl auth init again.
  • Wrong context activedoctl auth list then doctl auth switch --context <name>.
  • Registry push denied — run doctl registry login so Docker gets the short-lived registry credentials.
  • Spaces endpoint confusion — Spaces is S3-compatible; use aws s3 --endpoint-url https://<region>.digitaloceanspaces.com rather than looking for a doctl spaces subcommand.