Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.24 KB

README.md

File metadata and controls

44 lines (29 loc) · 1.24 KB

Kafka in Docker

This repository provides everything you need to run Kafka in Docker. It's a patched-up fork of spotify/docker-kafka which seems to be abandoned.

Why?

The main hurdle of running Kafka in Docker is that it depends on Zookeeper. Compared to other Kafka Docker images, this one runs both Zookeeper and Kafka in the same container. This means:

  • No dependency on an external Zookeeper host, or linking to another container
  • Zookeeper and Kafka are configured to work together out of the box

Run

First, launch the broker:

docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=0.0.0.0 --env ADVERTISED_PORT=9092 kchristidis/kafka

Then, from your localhost, launch a producer and a consumer:

kafka-console-producer.sh --broker-list localhost:9092 --topic test
kafka-console-consumer.sh --zookeeper localhost:2181 --topic test

Note that the ADVERTISED_HOST ENV var is optional; if not set, Kafka will bind itself on the host's IP, as retrieved via the hostname --ip-address command.

Get

TODO

  • Add TLS support