Kafka in Docker
The original repo is not uploaded to docker hub anymore. So I forked from https://hub.docker.com/r/spotify/kafka/ The latest version of kafka is: 2.8.0
===
This repository provides everything you need to run Kafka in Docker.
For convenience also contains a packaged proxy that can be used to get data from a legacy Kafka 7 cluster into a dockerized Kafka 8.
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:
docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=`docker-machine ip \`docker-machine active\`` --env ADVERTISED_PORT=9092 edwardg/kafka
export KAFKA=`docker-machine ip \`docker-machine active\``:9092
kafka-console-producer.sh --broker-list $KAFKA --topic test
export ZOOKEEPER=`docker-machine ip \`docker-machine active\``:2181
kafka-console-consumer.sh --zookeeper $ZOOKEEPER --topic test
Take the same parameters as the edwardg/kafka image with some new ones:
CONSUMER_THREADS - the number of threads to consume the source kafka 7 withTOPICS - whitelist of topics to mirrorZK_CONNECT - the zookeeper connect string of the source kafka 7GROUP_ID - the group.id to use when consuming from kafka 7docker run -p 2181:2181 -p 9092:9092 \
--env ADVERTISED_HOST=`boot2docker ip` \
--env ADVERTISED_PORT=9092 \
--env CONSUMER_THREADS=1 \
--env TOPICS=my-topic,some-other-topic \
--env ZK_CONNECT=kafka7zookeeper:2181/root/path \
--env GROUP_ID=mymirror \
edwardg/kafkaproxy
edwardg/kafka
The docker image with both Kafka and Zookeeper. Built from the kafka
directory.
edwardg/kafkaproxy
The docker image with Kafka, Zookeeper and a Kafka 7 proxy that can be configured with a set of topics to mirror.
https://registry.hub.docker.com/u/edwardg/kafka/
https://registry.hub.docker.com/u/edwardg/kafkaproxy/
docker build -t edwardg/kafka kafka/
docker build -t edwardg/kafkaproxy kafkaproxy/
Content type
Image
Digest
Size
252.5 MB
Last updated
over 5 years ago
docker pull edwardg/kafka