The issue with the internal DNS server is it is pretty opinionated / not configurable only resolves as <container>
and <container>.<stack>
– you can’t configure it with its own domain names or anything else. You also seem to not get responses from the internal DNS from external IP sources even if properly forwarded.
I put together a generic solution given I couldn’t figure out how to do it within just Docker/ Swarm – if others come across it – i created GitHub - exactlylabs/swarm-vpn-dns to resolve internal container names in your own domain namespace / on your own VPN… there’s still definitely some limitations here but tried to keep the thing as lightweight / non-opinionated as possible… all this said, I’d really hope Docker is able to find a better internal solution for this … i was pretty surprised that this scenario wasn’t really supported.