Quick tip - delete all LXD containers hosting juju


#1

The following shell command deletes all containers that start with the name juju:

lxc list --format=csv --columns=n juju | xargs lxc delete --force 

#2

For some reason the profile list in lxc doesn’t have a format flag, so you have to do some jumping through hoops to remove all the profiles…

lxc profile list | grep juju | tr -s ' ' | cut -d ' ' -f 2 | xargs -I % echo "lxc profile delete %" | sh

#3

Sounds like a useful issue to file with github.com/lxc/lxd


#4

TBH: I could just file a PR in my spare time :wink:


#5

To be fair, there should still be a bug you’re working against if you were to put up a PR. :slight_smile: