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!
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.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.