Kafka with Docker dynamic advertised_host_name
<p>I've been using wurstmeister/Kafka for a few weeks now in Dev and QA, but in each case I need to hard-code <code>KAFKA_ADVERTISED_HOST_NAME</code> to the IP of the box that it's on, using <code>docker-compose</code>. This hasn't been a problem during testing, but now that I'm trying to scale this out to production, it's becoming a little bit more frustrating. </p>

<p>I'm continuing to use <code>docker-compose</code> to somewhat manually deploy three instances of Kafka and Zookeper onto three separate cloud hosts. I've opened up the appropriate ports, and attempted everything in my limited Docker knowledge to dynamically assign <code>KAFKA_ADVERTISED_HOST_NAME</code>. Much to my dismay, it always yields some sort of error. The README on docker hub mentions assigning this variable dynamically VIA<br>
<code>HOSTNAME_COMMAND, e.g. HOSTNAME_COMMAND: "route -n | awk '/UG[ \t]/{print $$2}'"</code></p>

<p>This causes my application to obtain a connection refused response when attempting to connect. However, manually assigning the IP to the three hosts works perfectly fine. What am I missing here?!</p>