I'm looking at wurstmeister/kafka-docker, and found this pull suggesting using the IP address. Basically, it uses the docker info formatting:
HOSTNAME_COMMAND: "docker info -f '{{`{{.Swarm.NodeAddr}}`}}'"
I get the idea that it uses the formatting to get the address, but I don't understand what's going on with the extra {{...}} and the backticks (which would normally be an eval). docker-compose allows for ${variables}, but there's no dollar sign ($) here, so no need to escape. Why isn't this just:
HOSTNAME_COMMAND: "docker info -f '{{.Swarm.NodeAddr}}'"
I've seen this elsewhere, so I assume there's a reason.