Public | Automated Build

Last pushed: 2 years ago
Short Description
Docker image for Kafka
Full Description

##Apache Kafka on Docker

This repository holds a build definition and supporting files for building a Docker image to run Kafka in containers. It is published as an Automated Build on the Docker registry, as tianzk/kafka.

###Usage

You can run the default kafka command simply

docker run --rm -ti tianzk/kafka

this command will show some common script which packaged with kafka

To start a zookeeper you can use:

docker run --rm -ti --name zookeeper tianzk/kafka zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties

if you want to make your zookeeper visible to kafka containers which run on ohter host,you shuld use -p 2181:2181 to map zookeeper port ,that is:

docker run --rm -ti --name zookeeper -p 2181:2181 tianzk/kafka zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties

To start a kafka server you can use:

docker run --rm -ti --name kafka-server -e KAFKA_ADVERTISED_HOST_NAME=your-host-name-or-host-ip -e KAFKA_ADVERTISED_PORT=9092 -e KAFKA_BROKER_ID=0 --link zookeeper tianzk/kafka kafka-server-start.sh /usr/local/kafka/config/server.properties

or

docker run --rm -ti --name kafka-server -e KAFKA_ADVERTISED_HOST_NAME=your-host-name-or-host-ip -e KAFKA_ADVERTISED_PORT=9092 -e KAFKA_BROKER_ID=0 -e ZOOKEEPER_CONNECT=ip:port tianzk/kafka kafka-server-start.sh /usr/local/kafka/config/server.properties

KAFKA_ADVERTISED_HOST_NAME is required, KAFKA_ADVERTISED_PORT(9092 as default) and KAFKA_BROKER_ID(0 as default) are optional

Here is a docker compose file which shows a simple uses of this image.

Docker Pull Command
Owner
tianzk
Source Repository

Comments (0)