Wouldn't 127.0.0.1 be the loopback for the container itself? So you'd need to set the DNS to the gateway IP or dynamically by resolving `host.docker.internal` (assuming `--add-host=host.docker.internal:host-gateway`)
Docker also has special handling for systemd-resolved: if resolv.conf points at 127.0.0.53, it will use the managed resolv.conf located in /run.
> So you'd need to set the DNS to the gateway IP
This is the least friction way. Run your own resolver there to resolve names for containers, forward to the host's loopback for everything else.
> or dynamically by resolving `host.docker.internal`
Resolving. Name. Of the DNS server. Right?
This would require adding a script to the image itself, for each image. No go.