Correct /etc/sysconfig/network-scripts/ifcfg-eth0 settings to assign a static IP

Take a look at How to assign public ip to the container of centos where ubuntu focal as hypervisor for the commands to run.

Equally if you are using LXD’s DHCP service, then you can assign a static DHCP allocation in the LXD NIC device and the container can continue to use DHCP.