3

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~

Community
  • 1
  • 1
koma
  • 31
  • 1
  • 2
  • have a look at https://hub.docker.com/r/wurstmeister/kafka/ – user2915097 Feb 14 '17 at 08:49
  • Attention!!! I want to connect to my local host kafka brokers not in another docker container. – koma Feb 14 '17 at 09:00
  • I do not u nderstand when you say "I have a kafka server in my local host, and i want to connect it in my docker container." – user2915097 Feb 14 '17 at 09:07
  • please, clarify - what is run on container? does Kafka running on your local host, and you have another app running inside the docker on same host? – evgenyl Feb 14 '17 at 15:16
  • @evgenyl yes, the docker container also running in my local host and i want my app running in the docker container could connect to the kafka that running in my local host. – koma Feb 15 '17 at 02:33

2 Answers2

0

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.

Community
  • 1
  • 1
evgenyl
  • 7,197
  • 2
  • 25
  • 32
0

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!

saurabh
  • 491
  • 4
  • 7