But how is that done in practice? Say I have a legacy web server running outside the swarm, and it needs to call an API running in the swarm. Can this built-in DNS server be queried from outside of the cluster?
As I understand it, within the swarm containers can simply reference other services via their names and the built-in DNS will be used to find the appropriate IP and port automatically, but it would be useful to be able to query it externally too.