Hi, I have to run jobs for several hours, but after finishing them I want to destroy the droplet where they were being run. I have tried to accomplish this using doctl and an access token. The problem is that when I try to authenticate inside the droplet, running: doctl auth init --access-token $DO_TOKEN, I get the following error: Error: mkdir /root/.config: permission denied.
Any idea how to solve that? Or another way to destroy a droplet?
If it helps, I created the droplet using: doctl compute droplet create test --image ubuntu-20-04-x64 --size s-1vcpu-1gb --region nyc1 --ssh-keys $(key_md5)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I’m actually not that familiar with doctl but I was able to find this open bug:
https://github.com/digitalocean/doctl/issues/591
tl;dr: Try creating the ~/.config directory before running doctl for the first time, like this:
mkdir -p ~/.config
The -p flag is handy for scripting as it will not error out if the directory already exists.
Hope this helps, let us know if you have any other questions - good luck!
Hi there @antoniogamiz10,
I recently wrote an answer to a similar question on how to delete a Droplet after running a specific task:
https://www.digitalocean.com/community/questions/create-droplet-to-run-single-task-then-destroy
It includes a short script as well.
Hope that this helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
