ches / docker-kafka

Apache Kafka on Docker
https://hub.docker.com/r/ches/kafka/
146 stars 137 forks source link

Cannot connect to kafka broker #60

Open thuylevn opened 4 years ago

thuylevn commented 4 years ago

Using docker toolbox, after run $ docker network create kafka-net

$ docker run -d --name zookeeper --network kafka-net zookeeper:3.4 $ docker run -d --name kafka --network kafka-net --env ZOOKEEPER_IP=zookeeper ches/kafka

$ docker run --rm --network kafka-net ches/kafka \

kafka-topics.sh --create --topic test --replication-factor 1 --partitions 1 --zookeeper zookeeper:2181 Created topic "test".

In separate terminals:

$ docker run --rm --interactive --network kafka-net ches/kafka \

kafka-console-producer.sh --topic test --broker-list kafka:9092

$ docker run --rm --network kafka-net ches/kafka \

kafka-console-consumer.sh --topic test --from-beginning --bootstrap-server kafka:9092

Cannot connect to Kafka brocker http://192.168.99.100/9092

Any suggestions?

OneCricketeer commented 3 years ago

Change your third command.

docker run -d --name kafka --network kafka-net --env ZOOKEEPER_IP=zookeeper --env KAFKA_ADVERTISED_HOST_NAME=kafka ches/kafka