No description, website, or topics provided.
Switch branches/tags
Clone or download
Pull request Compare This branch is 8 commits ahead, 135 commits behind wurstmeister:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Dockerfile for Apache Kafka

The image is available directly from DockerHub

You can browse the source in GitHub


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 --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 --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 --zookeeper zookeeper:2181 --topic test --from-beginning


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- kafkadocker/kafka /bin/bash

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

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