Awesome, thanks Stephane. We can use the raw lxc command as a good fix.




On August 19, 2017 7:43:34 PM Stéphane Graber <stgra...@ubuntu.com> wrote:

On Sat, Aug 19, 2017 at 04:48:51PM -0400, Ron Kelley wrote:
Greetings all,

Trying to set the container hostname different that the container name. Editing /etc/hostname and /etc/hosts seems to work on Ubuntu but not on CentOS 6 containers. What is the proper way to set the hostname so it is persistent among reboots for CentOS containers? The LXD config guide (https://github.com/lxc/lxd/blob/master/doc/configuration.md) has no mention of a hostname keyword.

I'm not very familiar with RHEL/Centos and indeed couldn't find an easy
way (short of using /etc/rc.local) to set the hostname in a Centos 6
container the way I'd expect it to work...

It looks like centos6 looks at the kernel utsname and if it's already
set, won't change it, no matter what you put in /etc/hostname or
/etc/sysconfig/network. Though maybe I'm missing something and one of
our Red Hat / CentOS users will know how to get around this.


At the LXD level, you can use raw.lxc to force the utsname to another
value and that part does seem to work:

    lxc config set c1 raw.lxc lxc.utsname=some-name

--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com



----------
_______________________________________________
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


_______________________________________________
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to