How can I pass container name to node.name in elasticsearch.yml rather than duplicating it to all service name
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
container_name: es01
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- type: bind
source: ./elasticsearch.yml
target: /usr/share/elasticsearch/config/elasticsearch.yml
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
container_name: es02
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- type: bind
source: ./elasticsearch.yml
target: /usr/share/elasticsearch/config/elasticsearch.yml
- data02:/usr/share/elasticsearch/data
networks:
- elastic
networks:
elastic:
driver: bridge
elasticsearch.yml
node.name: es01
cluster.name: es-docker-cluster
discovery.seed_hosts: es02,es03
cluster.initial_master_nodes: es01,es02,es03
bootstrap.memory_lock: true
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
Therefore, instead of having node.name=es01 is there a way i can do node.name=${container_nane}?