The easiest way is to use libcluster for this, it does automatically a lot of things, like automatic connection, discovery etc.
Make sure to read about the available clustering strategies, the default one used by erlang is EPMD. Outside of EPMD, I’ve personally used in production Cluster.Strategy.Gossip with docker containers and it works out of the box.






















