Docker Community Forums

Share and learn in the Docker community.

{{node.hostname}} usage in docker-compose.yml in Docker swarm mode

docker
swarm

(Franklintempletoninv) #1

Hi Team,

I have stable elk cluster working on dev env for few weeks, and I have started exploring swarm and hence I need to modify docker-compose file for some of settings .

I am finding trouble setting individual hostnames when I run from swarm manager

Blockquote
Before Swarm mode I have this working config where variables are sourced by .env files of individual server :

  - "transport.host=${HOST1}"
  - "network.publish_host=${HOST1}"
  - "node.name=ess_elasticsearch1_master_${HOST1}"

When it comes to swarm mode I am finding trouble finding same when it comes to variables :slight_smile:
I have tried these below options but none helped me setting the same
- transport.host: ‘{{.Node.Hostname}}’
- network.publish_host: ‘{{.Node.Hostname}}’
- node.name=ess_elasticsearch1_master_’{{.Node.Hostname}}’

Above settings in docker-compose file did not help me.

Please let me know if you have thoughts on this, Thanks in advance.