Reputation: 51
I have a kafka server in my local host, and i want to connect it in my docker container.
I had searched how to connect local services in docker container and i found this: how-to-connect-to-local-mysql-server-through-docker
But it didn't work. Please help me, thanks~
Upvotes: 5
Views: 6589
Reputation: 115
https://github.com/provectus/kafka-ui/discussions/1081
In my Kafka server.properties I had advertised.listeners=PLAINTEXT://localhost:9092. This only allow access via localhost. Once I changed it to my machine's IP address everything worked fine.
Upvotes: 1
Reputation: 681
Try updating kafka config as shown below
$ nano config/server.properties
uncomment listeners and paste the following
listeners=PLAINTEXT://<local-ip>:9092
save file & restart kafka.
Hope this helps!
Upvotes: 3
Reputation: 8107
If I understand right, you question can be re-phrased as "How can I access my host machine withing my docker container".
As i wrote in another answer, you can set gateway when starting your container, create some kind of proxy to access your Kafka or take the host ip from container.
Upvotes: 0