While the answer given by @MagicMicky is correct, I will try to add more context about the difference between Swarm Legacy and Swarm Mode regarding Service Discovery:
Note . I will refer to the first version of Swarm as a legacy of Swarm, and the new version to Swarm mode.
Discovery Service Using Swarm Legacy
Swarm Legacy, Zookeeper, Consul Etcd , , . Key/Value . Swarm , node .
Service Discovery , Swarm, //DNS, , . , , , Swarm, Wagl.
(1.11) DNS . 1.11 () /etc/hosts.
Swarm, , . "".
"" Swarm , - , , , Service Discovery Load Balancing, .
Docker Swarm
Docker 1.12 Swarm DNS . , , Service Discovery Load Balancing.
, DNS- , , , . , , LB.
Swarm "" , ( , , , , , ), , . - , .