On Thu, Jan 21, 2016 at 6:25 PM, Dennis Jacobfeuerborn dennisml@conversis.de wrote:
On 21.01.2016 15:44, C. L. Martinez wrote:
Hi all,
I have installed a CentOS6 lxc guest under a Debian 8.x LXC host. All it is working ok but I can't change the hostname for the centos6 lxc container (it is using the same hostname from Debian host). I have modifyed HOSTNAME under /etc/sysconfig/network and /etc/hosts file, but it doesn't works.
Do I need to change anything else??
These Files only persist the hostname. To actually set it live you have to call "hostname <hostname>". Your shell prompt will not change unless you log out and log in again though simply executing "hostname" without parameters should output the correct name right away.
Keep in mind though that setting the hostname in a container requires explicit support for the UTS namespace on the host:
http://man7.org/linux/man-pages/man7/namespaces.7.html
If the host doesn't support the UTS namespace for its guests or this feature is not configured for the guest in question then setting the hostname in the guest is not possible.
Regards,
Thanks Dennis. I have tried to fix using "hostname" command but after reboot, returns to be the same hostname as Debian host. Debian kernel has UTS enabled ...