[CentOS-virt] Hostname inside lxc container

Thu Jan 21 17:31:12 UTC 2016
Scott Dowdle <dowdle at montanalinux.org>


----- Original Message -----
> 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??

If I remember correctly, it is generally set in /etc/sysconfig/network on a regular EL6 host.  If that isn't working when run within an LXC container on a Debian host... ask whoever packaged up the LXC container template you used.  There is a lot of variance in LXC from one distro to another.  Some recipes say to install from a .tar.gz file (which I prefer to call an OS Template) others say to do a chroot install using a distro's native package manager.  My point is, that LXC tools and methods really vary... and I don't think the CentOS project can help much in this situation.

For containers, I've been using OpenVZ (now called OpenVZ Legacy while they work on the newer Virtuozzo 7) for 10 years now... and they have a standard set of OS Templates for a range of distros and everything (generally) works as it is supposed to... and even with that... the CentOS Project isn't interested in helping OpenVZ users running CentOS containers... because it uses a non-CentOS provided kernel and management tools... although the recommended OpenVZ Legacy hostnode distro is CentOS 6.x.  Virtuozzo 7 is its own distro rebased from CentOS 7.

One container technology they are interested in supporting is Docker (app containers) especially when using the official CentOS Docker images built/provided by the CentOS Project... running on a CentOS host.

Scott Dowdle
704 Church Street
Belgrade, MT 59714
(406)388-0827 [home]
(406)994-3931 [work]