Source: Digital ocean doctl
← Renderedmarkdown source:
---
description: Doctl интерфейс командной строк=и digital ocean
tags: digital-ocean cli
title: Digital ocean doctl
---
doctl Command Line Interface [[cl]]. Доступ через командную строку к сервисам [[digital-ocean]]
[Ссылка на репозиторий](https://github.com/digitalocean/doctl)
## Instalation
[How to Install and Configure doctl](https://docs.digitalocean.com/reference/doctl/how-to/install/)
- Step 1: Install doctl
- Step 2: Create an API token
- Step 3: Use the API token to grant account access to doctl
- Step 4: Validate that doctl is working
Для установки на ubuntu понадобится [[linux-snap]]
Как создавать [API-token на digital ocean](https://docs.digitalocean.com/reference/api/create-personal-access-token/)
Затем нужно ваутентифицироваться, создав соответствующий контекст:
`doctl auth init --context <NAME>`
Контекст потребуется, если нужно менять аккаунты, к которым осуществляется доступ через doctl. Получить список контекстов и переключиться:
- `doctl auth list`
- `doctl auth switch --context <NAME>`
После переключения на созданный контекст, проверить, чт овсе работает можно так: `doctl account get`
## Login and logout
`doctl registry login -t <secret>` - example of login with secret by bash comand
`doctl registry logout`
## Список доступных команд
[Смотри тут](https://docs.digitalocean.com/reference/doctl/reference/)
## Доп.ресурсы
- [How To Work with DigitalOcean Load Balancers Using Doctl](https://www.digitalocean.com/community/tutorials/how-to-work-with-digitalocean-load-balancers-using-doctl)
- [How To Secure Web Server Infrastructure With DigitalOcean Cloud Firewalls Using Doctl](https://www.digitalocean.com/community/tutorials/how-to-secure-web-server-infrastructure-with-digitalocean-cloud-firewalls-using-doctl)
- [How To Work with DigitalOcean Block Storage Using Doctl](https://www.digitalocean.com/community/tutorials/how-to-work-with-digitalocean-block-storage-using-doctl)
Смотри так-же [[digital-ocean-docker-install]]
- [Проблемы с аутентификацией в doctl](https://github.com/digitalocean/doctl/issues/703) - по этой причине могут быть сложности с аутентификацией в [[github-action]]
- [How to authorize doctl in a script](https://www.digitalocean.com/community/questions/how-to-authorize-doctl-in-a-script)
- [Command Line Interface (CLI) Reference for doctl](https://docs.digitalocean.com/reference/doctl/reference/)
- [**How To Use Doctl, the Official DigitalOcean Command-Line Client**](https://www.digitalocean.com/community/tutorials/how-to-use-doctl-the-official-digitalocean-command-line-client) - большой и **максимально полезный** гайд
[cl]: cl "ci/cd - непрервыная интеграция"
[digital-ocean]: ../lists/digital-ocean "Digital ocean"
[linux-snap]: linux-snap "Linux-snap"
[digital-ocean-docker-install]: digital-ocean-docker-install "Digital ocean docker install"
[github-action]: github-action "Githunb action"