Temporarily add the LXD DNS server to your host machine.

First, add the DNS server of lxdbr0.

sudo resolvectl dns lxdbr0 $(ip -f inet addr show lxdbr0 | sed -En -e 's/.*inet ([0-9.]+).*/\1/p')

Second, make sure all requests to *.lxd are sent to that DNS server.

sudo resolvectl domain lxdbr0 lxd

After this, any requests to containername.lxd will be resolved to the container IP address. Make sure to add .lxd to the hostname.

source How to enable hostname resolution (dns) for lxd containers from the lxd host ? - Ask Ubuntu