Docker Community Forums

Share and learn in the Docker community.

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


(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

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

  - "${HOST1}"
  - "network.publish_host=${HOST1}"
  - "${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
- ‘{{.Node.Hostname}}’
- network.publish_host: ‘{{.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.