Elastic Search with Docker

Hmm, interesting. Did you wait long enough for them to find each other and form a cluster post boot-up? The docker-compose.yml you've pasted and the example one in the docs are exactly the same. When I run it, I get

1598034943 18:35:43 docker-cluster green 2 2 0 0 0 0 0 0 - 100.0%

i.e. 2 nodes of this exact version of Elasticsearch, exactly as it's supposed to work. I can't see an obvious reason why I can't reproduce it.