Skip to content

DockerKafka/kafka-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kafka-docker

Dockerfile for Apache Kafka

The image is available directly from DockerHub

You can browse the source in GitHub

Usage

Pull the image.

$ docker pull dockerkafka/kafka

Start a server.

$  docker run -d --name kafkadocker_zookeeper_1  dockerkafka/zookeeper
$  docker run -d --name kafkadocker_kafka_1 --link kafkadocker_zookeeper_1:zookeeper dockerkafka/kafka

Create a topic.

$  docker run -it --rm --link kafkadocker_zookeeper_1:zookeeper dockerkafka/kafka kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 5 --topic test

###Connect to the server ...

Don't bother the WARN Property topic is not valid (kafka.utils.VerifiableProperties) warn. It is a bug KAFKA-1711.

... as a producer.

After connection, you will got a stream. Every line is a new message.

$  docker run -it --rm --link kafkadocker_kafka_1:kafka dockerkafka/kafka kafka-console-producer.sh --broker-list kafka:9092 --topic test

... as a consumer.

After connection, all of the sent messages will be fetched, then wait for new messages.

$  $ docker run -it --rm --link kafkadocker_zookeeper_1:zookeeper --link kafkadocker_kafka_1:kafka dockerkafka/kafka kafka-console-consumer.sh --zookeeper zookeeper:2181 --topic test --from-beginning

Customization

Check out this repository, you will found the default Kafka configuration files under image/conf.

Start the container with the following line, so now you can modify the config in your host, and then start the server.

$  docker run -it --rm --volume `pwd`/image/conf:/opt/kafka_2.10-0.8.2.1/config kafkadocker/kafka /bin/bash

After you finished the customization & testing of the config changes, build your own image.

$  docker build --tag="my-image" .

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%