No name resolution for LXD containers using libvirt virbr0 as bridge

Found a solution.

Inside a CentOS 8 container you find in

/etc/sysconfig/network-scripts/ifcfg-eth0

the term

DHCP_HOSTNAME=`cat /proc/sys/kernel/hostname`

If you replace it statically with your hostname like

DHCP_HOSTNAME=“test02”

everything works fine.

@stgraber could you tell me what to modify in my installation to create the DHCP_HOSTNAME the same way as HOSTNAME or might it be advantageous to modify the CentOS 8 container in general?

NBB: In CentOS7 the substitution worked fine. So it might be specific for version 8.

On the command line a cat /proc/... works fine, but not inside ifcfg_eth0