A simple docker kafka container with with an embedded zookeper. Useful for running as part of gitlab CI.
This repository is a modification from MartinNowak's repository
For kafka:2.1.1 example:
$ docker build --build-arg KAFKA_VERSION=2.1.1 -t <you username>/kafka:2.1.1 .
$ docker run -p 2181:2181/tcp -p 9092:9092/tcp <you username>/kafka
A working docker-compose example
kafka:
image: ros65536/kafka:2.1.1
ports:
- "9092:9092"
- "2181:2181"
volumes:
- ./tmp/kafka:/var/lib/kafka
environment:
ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
BROKER_ID: 1
Optionally use specific broker id, docker run --rm -it --env=BROKER_ID=1 ros65536/kafka.
# generate unique id by default
ENV BROKER_ID=-1
Optionally mount persistent volume, docker run --rm -it --volume=/tmp/host/kafka:/var/lib/kafka ros65536/kafka.
VOLUME /var/lib/kafka
Optionally publish ports on host, docker run --rm -it --publish=2181:2181 --publish=9092:9092 ros65536/kafka.
EXPOSE 2181/tcp 9092/tcp
Optionally build with a different version, docker build --build-arg=KAFKA_VERSION=0.11.0.2 ..
ARG KAFKA_VERSION=1.0.0
ARG SCALA_VERSION=2.11
Content type
Image
Digest
Size
180.9 MB
Last updated
over 7 years ago
docker pull ros65536/kafka:2.1.1