Unable to destroy containers

Hi everyone,

I’m facing a strange issue. When I do lxc list on my console I get a list of containers on my system. However when I try to destroy one of those containers using lxc-destroy --name=“container-name” I get

Container is not defined

response back from the client. Any ideas on what might be the issue?

The containers were all built by juju, if that is relevant

Thanks,
Akshat

You are mixing the LXD commands with the LXC commands.
Here is how to delete a container.

$ lxc list -cns
+---------------+---------+
|     NAME      |  STATE  |
+---------------+---------+
| mycontainer   | RUNNING |
+---------------+---------+
$ lxc stop mycontainer
$ lxc delete mycontainer
$

and that’s it.

You can remove the lxc1 package in order to avoid using by accident those LXC 1.0 commands.

2 Likes

Thanks @simos! It worked.