Docker does not support --net-alias=<service name>-<n>
. You have to create one service for each replica, and you could name service like <service name>-<n>
.
There are 2 good discussions/examples about how to setup distributed database on Docker swarm. How to handle database replication and get zookeeper running in docker swarm mode.