Updating the SWARM DNS from within containers

With the docker service create call you can specify --hostname="{{.Service.Name}}-{{.Task.Slot}}"

The containers obtain this hostname but still can’t ping one another in an overlay network.

Trying to update the DNS with a command like nsupdate fails.

Is there a way to dynamically update the DNS. Or a more correct way to make it so hosts with a predefined “templated” name can ping each other? like host ‘service-1’ can ping host ‘service-2’ knowing there are 2 replicas in the service?