/docker-kafka-alpine

Alpine Linux based Kafka Docker Image

Primary LanguageShellMIT LicenseMIT

kafka-logo

docker-kafka-alpine

Publish Docker Image License Docker Stars Docker Pulls Docker Image

Alpine Linux based Kafka Docker Image

Dependencies

Image Tags

REPOSITORY          TAG                 SIZE
blacktop/kafka      latest              506MB
blacktop/kafka      3.3                 506MB
blacktop/kafka      3.2                 410MB
blacktop/kafka      3.1                 461MB
blacktop/kafka      3.0                 461MB
blacktop/kafka      2.8                 473MB
blacktop/kafka      2.7                 473MB
blacktop/kafka      2.6                 473MB
blacktop/kafka      2.5                 438MB
blacktop/kafka      2.4                 441MB
blacktop/kafka      2.3                 437MB
blacktop/kafka      2.2                 411MB
blacktop/kafka      2.1                 461MB
blacktop/kafka      2.0                 461MB
blacktop/kafka      1.1                 332MB
blacktop/kafka      1.0                 441MB
blacktop/kafka      0.11                226MB
blacktop/kafka      0.10                437MB
blacktop/kafka      0.9                 238.6MB
blacktop/kafka      0.8                 227.5MB

Getting Started

NOTE: I am assuming use of Docker for Mac with these examples.( KAFKA_ADVERTISED_HOST_NAME=localhost )

docker run -d \
           --name kafka \
           -p 9092:9092 \
           -e KAFKA_ADVERTISED_HOST_NAME=localhost \
           -e KAFKA_CREATE_TOPICS="test-topic:1:1" \
           blacktop/kafka

This will create a single-node kafka broker (listening on localhost:9092), a local zookeeper instance and create the topic test-topic with 1 replication-factor and 1 partition .

You can now test your new single-node kafka broker using Shopify/sarama's kafka-console-producer and kafka-console-consumer

Required

$ go get github.com/Shopify/sarama/tools/kafka-console-consumer
$ go get github.com/Shopify/sarama/tools/kafka-console-producer

Now start a consumer in the background and then send some data to kafka via a producer

$ kafka-console-consumer --brokers=localhost:9092 --topic=test-topic &
$ echo "shrinky-dinks" | kafka-console-producer --brokers=localhost:9092 --topic=test-topic

Documentation

Issues

Find a bug? Want more features? Find something missing in the documentation? Let me know! Please don't hesitate to file an issue

Credits

Heavily (if not entirely) influenced by https://github.com/wurstmeister/kafka-docker

Todo

  • Add ability to run a single node kafka broker when you don't supply a zookeeper link.

License

MIT Copyright (c) 2016-2022 blacktop