I would like to generate an alternative /etc/hosts file with all IPs and hostnames for all containers. I will then use dnsmasq's --addn-hosts to read this file in and provide resolving of containers.
Currently, my template is:
{{ range $index, $container := $ }}
{{ $container.IP }} {{ $container.Hostname }}
{{ end }}
But with recent Docker additions I am not sure if this really lists all IPs for all containers and their hostnames. Doesn't container have multiple IPs in multiple networks? How could I list all IP from all networks and then for each of those IPs all hostnames? So hostname and also hostname.network_name?