To rename an LXD / LXC container, you can use the lxc move
command. This command allows you to move a container from one location to another, including renaming the container.
Here is an example of how to use the lxc move
command to rename a container:
lxc move old_name new_name
Replace old_name
with the current name of the container, and new_name
with the new name you want to give the container.
Keep in mind that this command will only work if the new name is a valid container name and is not already in use by another container. It is also important to note that this command will only rename the container, and will not modify any configuration files or other resources associated with the container.
If you want to modify the configuration files or other resources associated with the container, you will need to do so manually after renaming the container.
It's also a good idea to make sure that the container is stopped before renaming it, as the lxc move
command may not work properly if the container is running. You can stop the container using the lxc stop
command, like this:
lxc stop old_name
Replace old_name
with the current name of the container.
Once the container has been stopped, you can use the lxc move
command to rename it, as shown above. After renaming the container, you can start it again using the lxc start
command:
lxc start new_name
Replace new_name
with the new name of the container.