conduktor / kafka-stack-docker-compose

docker compose files to create a fully working kafka stack
Apache License 2.0
3.24k stars 1.25k forks source link

Can't connect App on docker to Kafka #86

Closed manhvd161 closed 2 years ago

manhvd161 commented 3 years ago

I run the docker-compose file with multiple zookeeper and multiple broker on my app. I use KafkaJS and try to send messages from an external application. At this time, the subscribing of consumer is fine, but when I send messages from an app in docker that is on the same network as Kafka, I can't connect

This is docker-compose file:

https://drive.google.com/file/d/1WvwELcouEd9n5mZr1ns2w8G6whfndTnz/view?usp=sharing

After that, I get an error as below Screen Shot 2021-03-23 at 09 25 45

Please help me fix that. Thank you!

simplesteph commented 2 years ago

You would need to have that app in the same Docker Compose file (not running externally using docker) so that it shares the same network, and the connection URL for Kafka would be kafka:9092, not 127.0.0.1:9092