Cannot produce message to kafka from service running in docker
<p>I've a rest service running in docker container on port 5000 which is used to produce message over kafka topic running out of docker container.</p>

<p>I've configure my producer client with below properties :-</p>

<pre><code>bootstrap.servers=localhost:9093
</code></pre>

<p>And I've started my contained with below command:-</p>

<pre><code>docker run -d -p 127.0.0.1:5000:5000 &lt;contained id&gt;
</code></pre>

<p>I've also made below configuration to advertise kafka host and port</p>

<pre><code>advertised.host.name=localhost
advertised.port=9093
</code></pre>

<p>Despite of having all configuration when I try to produce to a kafka topic then I get below error:-</p>

<pre><code>org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.
</code></pre>

<p>Can someone please point where the actual problem is?</p>