ES 5.6.16 Docker cluster on multiple physical machines via Docker on custom ports


I'm trying to set up a ES cluster via docker-compose on multiple machines, 4 in total. They are part of the same internal network and I think I'm fairly close, but the nodes still don't seem to see each other.

The main problem is that all the physical machines have ES 2.4 running directly on the host, so I figured I'll try to set up ES 5 (as the overlying software dropped support for ES 2.x) on the same machines, see if it all works. That's why I have to use different ports than 9200 and 9300.

docker-compose.yml (only and network.publish_host change among the cluster):

version: '2'
    container_name: ors-es4
      - network.bind_host=
      - network.publish_host=
      - transport.tcp.port=9310
      - http.port=9210
      - discovery.zen.minimum_master_nodes=3
      - gateway.recover_after_nodes=3
      - gateway.expected_nodes=4
      - gateway.recover_after_time=5m
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        soft: -1
        hard: -1
      - /srv/elasticsearch/es5:/usr/share/elasticsearch/data
      - 9210:9200
      - 9310:9300

This still results in

[2019-07-23T13:25:19,347][WARN ][o.e.d.z.ZenDiscovery     ] [ors-pelias-n4] not enough master nodes discovered during pinging (found [[Candidate{node={ors-pelias-n4}{aIUg_aiATPalwga82pzcMg}{vU0cNqgMTxCy0WlGPPx3jA}{}{}{ml.max_open_jobs=10, ml.enabled=true}, clusterStateVersion=-1}]], but needed [3]), pinging again

I tried to add :9310 to all unicast.hosts and a few other things related to host names and ports, no luck (sorry, can't remember it all, been playing around since 5 hours basically).