A simplified version of the multi-node example. Good for learning, but easy to extend to multiple nodes if needed. See the docs for all that is recommended for using docker-compose in production.
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
volumes:
data01:
driver: local
networks:
elastic:
driver: bridge
Visit http://localhost:9200/_cat/nodes?v=true&pretty to verify that it is running.