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)
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
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
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 runningdoctl
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!