Passing Hostname To Docker Services

Apr 29, 2021  ·  ~1min read
Notes #docker #hostname #linux

Passing hostname to docker container won’t work

environment:
  - "HOST_HOSTNAME=$HOSTNAME"

Do this instead

environment:
  - "HOST_HOSTNAME={{ .Node.Hostname }}"

It will fetch the hostname from docker placeholder

Reference

Thank you for reading!