Spotify for 0.10.x, wurstmeister/kafka since 1.0.0 (use spotx/zookeeper with 1.0.0+)
10K+
This repository provides everything you need to run Kafka in Docker.
Updated for Kafka 0.10.2.0.
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:
Start the container:
docker run -p 2181:2181 -p 9092:9092 spotx/kafka:1.0.0
Write a test message to kafka:
docker exec -it <container_id> ./opt/kafka_2.11-1.0.0/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
Read the test message:
docker exec -it <container_id> ./opt/kafka_2.11-1.0.0/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
In a more complex setup, internal and external listeners can be defined to allow access from outside the container
version: '3'
services:
kafka:
image: spotx/kafka:1.0.0
ports:
- "2181:2181"
- "9092:9094"
environment:
KAFKA_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://kafka:9094
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:9094
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
docker-compose -f <compose_file>.yml up
Write a test message to kafka:
kafka-console-producer.sh --broker-list localhost:9092 --topic test
Read the test message:
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
spotx/kafka
The docker image with both Kafka and Zookeeper. Built from the kafka
directory.
https://hub.docker.com/r/spotx/kafka/
docker build -t spotx/kafka kafka/
Content type
Image
Digest
Size
230.6 MB
Last updated
about 7 years ago
docker pull spotx/kafka