LXD Container Rename

 

What are we doing?

  • Renaming containers in LXD

 

Why?

Because OCD means we like functional naming conventions.
 

How?

I had an issue recently whereby I wanted to build a container to mirror an out of date, running container, delete the old container then have the new one take its place. The issue came when I tried to rename the new container to match previously used conventions.

LXD documentation shows that container renaming has been possible for a long time and has had numerous bugs fixed for well over a year at the time of writing- but no instruction on how to do so. I also found some very complicated, though ultimately useless, guides floating around online.

As it turns out, it’s very simple.

To clone a container, keeping the existing one

lxc copy <source container> <destination container>

Or, to rename a container

lxc move <old name> <new name>

 

Leave a Reply

Your email address will not be published. Required fields are marked *