Trying to rename an LXD container? We can help you with it.
LXD is a daemon that provides a REST API to drive LXC containers.
Here at Bobcares, we often receive requests to rename the LXD containers as a part of our Server Management Services.
Today, let’s see how our Support Engineers change the LXD container name.
Explore more about LXD containers
LXD stands for Linux Container Daemon
It provides a user experience that is quite similar to that of virtual machines.
LXD focuses on system containers, also called machine containers. That is, an LXD container runs a full Linux system.
LXD is an image-based container. That is, all LXD containers come from an image. Let us discuss how our Support Engineers rename the container.
Renaming LXD container
Having a decade of experience in managing servers, our Dedicated Engineers are familiar with the LXD containers. Now, let’s see how our Support Engineers rename the LXD containers.
It is not allowed to rename a running container. So we need to stop the container initially and then we need to rename it.
So let’s first start the process of renaming the container by stopping it.
We use the below command to stop the container.
lxc stop old-lxc
Now, we rename it through the below command
lxc move old-lxc new-lxc
Then we start the container
lxc start new-lxc
After that, we verify its working by running the below command
lxc info new-lxc
Here is a screenshot of the result of the above command.
We can log into the new container through the command
lxc exec new-lxc bash
Here, we can change the hostname in the /etc/hosts if necessary.
After any changes, we restart it by running the command
lxc restart new-lxc
Also, we can move a container between two hosts, renaming it if the destination name differs. The syntax is:
lxc move [<remote>:][<remote>:][<destination container>]
lxc stop server1:xxx
lxc move server1:xxx server2:yyy
[Need any assistance with LXD containers? – We’ll help you]
Conclusion
In short, we can rename the LXD containers by following few commands. Today, we saw how our Support Engineers rename the LXD containers.
0 Comments