Dockerfile for single node kafka. It also include zookeeper. This docker image is supposed to run for test on development environment, not for production usage.
tcnksm/single-kafka
image support below tags. Link is its Dockerfile
.
Tag is correspond to ${SCALA_VERSION}-${KAFKA_VERSION}
.
To run single node kafka,
$ docker run --rm -it \
--name single-kafka \
--publish 9092:9092 \
--publish 2181:2181 \
--env ADVERTISED_HOST=192.168.59.103 \
--env ADVERTISED_PORT=9092 \
tcnksm/single-kafka
To connect it from outside of docker container, you need to expose 2 ports and set 2 env variables. 9092
for broker and 2181
for zookeeper. ADVERTISED_HOST
is host IP where kafka works (in this case it is docker host) and ADVERTISED_PORT
is broker port.
To try kafka you can use kafkacat,
$ echo 'This is test message' | kafkacat -t test-topic -b 192.168.59.103:9092
$ kafkacat -C -t test-topic -b 192.168.59.103:9092
- Fork (https://github.com/tcnksm/dockerfile-single-kafka/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Push it to your remote repository
- Create new Pull Request