Public | Automated Build

Last pushed: 2 years ago
Short Description
This is an image for apache kafka based on ubuntu:trusty docker image
Full Description


This is an image for apache kafka based on ubuntu:trusty docker image

Supported tags and respective Dockerfile links:

latest may be broken as it is not checked by CircleCI as it is built by docker hub,
circleci tag is pushed only after build and verification passed on CircleCI,
0.9.0 tag is marking that kafka version is 0.9.0 tag is marking that kafka version is


The container has default environment variables that shouldn't be touched:

Environment Variable Description Value
KAFKA_HOME home directory where kafka is installed /opt/kafka/
KAFKA_CONFIG_FILE configuration file for zookeeper /opt/kafka/config/

To run the container:

docker run -d -ti -e KAFKA_HEAP_OPTS="-Xmx64M -Xms64M" -e KAFKA_BROKER_ID=1 -e KAFKA_ZOOKEEPER_CONNECT=",," -e KAFKA_ADVERTISED_PORT=9092 -e KAFKA_ADVERTISED_HOST_NAME="" --publish 9092:9092 --name kafka-node-1 -v /data/kafka/node1:/tmp/kafka-logs vasylpurchel/kafka

To configure kafka instance you can use environment variables that starts with a same name as kafka configuration entries with KAFKA_ prefix, uppercase and words splitted by _ instead of .

Few examples:

Environment Variable Zookeeper Property

By default in file default values are:

Kafka Property Value 0
listeners PLAINTEXT://:9092 3 8
socket.send.buffer.bytes 102400
socket.receive.buffer.bytes 102400
socket.request.max.bytes 104857600
log.dirs /tmp/kafka-logs
num.partitions 1 1
log.retention.hours 168
log.segment.bytes 1073741824 300000
log.cleaner.enable false
zookeeper.connect localhost:2181 6000

To save data you need to mount volume to KAFKA_LOG_DIRS is generating configuration for container and runs any parameters after,
so you can use this image to run other kafka related tasks and not only starting server with config(default one)


Make sure you are in kafka folder and that ip address in docker-compose.yml file is correct (mine is

ifconfig | grep "docker0" -C 2 | grep "inet addr"

build image:

docker build -t vasylpurchel/kafka .

run 3 nodes from docker-compose:

docker-compose up

check that it works just run:

docker run -d -ti vasylpurchel/kafka --create --zookeeper,, --replication-factor 2 --partitions 3 --topic test
Docker Pull Command
Source Repository