Hello All,
I would like to know if it is possible to allow containers and/or virtual machines being created to automatically update DNS server. This containers are ad-hoc.
Once the container has been created a developer must manually find the IP address of the newly-created container.
This is cumbersome, and can occasionally these containers need to re re-created if a container or VM changes its IP address.
I am currently researching on using piHole still not sure if this is the right solution.
Having said that, you can enable your host to resolve name resolution of your Incus containers.
Here is how it looks. I launch an Incus container, called mycontainer. I then try to ping it, it fails (default setup). I then get the IP address of the interface and the domain (if it is empty, as in this case, the domain is .incus). I set them up with resolvectl and that’s it. Finally, I can ping the Incus container from the host.
$ incus launch images:debian/12/cloud mycontainer
Launching mycontainer
$ ping mycontainer.incus
ping: mycontainer.incus: Name or service not known
$ incus network get incusbr0 ipv4.address
10.10.10.1/24
$ incus network get incusbr0 dns.domain
$ sudo resolvectl dns incusbr0 10.10.10.1
$ sudo resolvectl domain incusbr0 '~incus'
$ ping -c 1 mycontainer.incus
PING mycontainer.incus(mycontainer.incus (....................)) 56 data bytes
64 bytes from mycontainer.incus (.....................): icmp_seq=1 ttl=64 time=0.041 ms
--- mycontainer.incus ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.041/0.041/0.041/0.000 ms
$