How can I run a wildfly cluster using docker swarm?

I’ve read that the main benefit of docker swarm is high availability.

So I would like to use it for deploying wildfly instances containing my application.

However wildfly session replication requires that each instance runs with a unique node name e.g. passed on each node’s startup command: -Djboss.node.name=node1, -Djboss.node.name=node2 e.t.c. and that all nodes can initiate communication and advertise themselves to the load-balancer via a multicast addressing.

How can I provide the following two features using docker-swarm? e.g.

  • Is there any unique name per swarm node which could be used for passing to wildfly?
  • Is there a (free) way to support multicast addressing inside the swarm network?

Source: Docker Questions