Hi,

I would want to discuss a problem I am facing while trying to use Kafka in
Docker container.

My topology is simple:

One Linux VM running a Docker machine.
- One container for Zookeeper
- One container for Kafka

I publish subscribe to the Broker from a client on my local machine, which
is in the same network as the VM.



*Problem statement*

   1. *Using advertised.host.name <http://advertised.host.name> as the host
   IP of the Docker container* - Producer is able to resolve topic
   partition leader, as fetched from Zookeeper and publish works fine.
   However, a broker metadata fetch for the consumer will keep giving
   LEADER_NOT_AVAILABLE warnings, since the host IP is not resolvable from
   inside of container, by the broker.
   2. *Using advertised.host.name <http://advertised.host.name> as the
   internal IP of the Docker container* - Producer operation will timeout
   now, since the internal IP as fetched from Zookeeper is not resolvable from
   the client.

End result is that I am unable to have publish/subscribe both work at the
same time!

Here are a couple of SOF posts with similar problems faced:

https://stackoverflow.com/questions/37290005/publishing-a-message-to-kafka-running-inside-docker

https://stackoverflow.com/questions/32302444/interact-with-kafka-docker-container-from-outside-of-docker-host


<https://stackoverflow.com/questions/32302444/interact-with-kafka-docker-container-from-outside-of-docker-host>


Do we have any clean solution for this, without getting much into
networking/NAT techniques?


Thanks,

Sutanu

Reply via email to