A production-ready Docker container for Apache Kafka with Zookeeper.
354
Production-ready Apache Kafka with Zookeeper in a single container. Configurable host settings for any deployment environment.
docker run -p 2181:2181 -p 9092:9092 -e KAFKA_HOST=localhost hatakekakashihk/kafka:latest
KAFKA_HOST environment variable# For localhost development
docker run -d --name kafka \
-p 2181:2181 -p 9092:9092 \
-e KAFKA_HOST=localhost \
hatakekakashihk/kafka:latest
# For production with custom host
docker run -d --name kafka \
-p 2181:2181 -p 9092:9092 \
-e KAFKA_HOST=your-server.com \
--restart unless-stopped \
hatakekakashihk/kafka:latest
version: '3.8'
services:
kafka:
image: hatakekakashihk/kafka:latest
ports:
- "2181:2181"
- "9092:9092"
environment:
- KAFKA_HOST=${KAFKA_HOST:-localhost}
restart: unless-stopped
| Environment Variable | Description | Default |
|---|---|---|
KAFKA_HOST | Hostname/IP for external connections | localhost |
| Port | Service |
|---|---|
2181 | Zookeeper |
9092 | Kafka |
# Create a topic
docker exec -it kafka /opt/kafka/bin/kafka-topics.sh \
--create --topic test --bootstrap-server localhost:9092
# Send a message
echo "Hello Kafka" | docker exec -i kafka /opt/kafka/bin/kafka-console-producer.sh \
--topic test --bootstrap-server localhost:9092
# Read messages
docker exec -it kafka /opt/kafka/bin/kafka-console-consumer.sh \
--topic test --from-beginning --bootstrap-server localhost:9092
Maintained by: Hemant Kumar
Content type
Image
Digest
sha256:d0c8c88b0…
Size
28.2 MB
Last updated
12 months ago
docker pull hatakekakashihk/kafka:v1.0.3