tcnksm / dockerfile-single-kafka

Dockerfile for single node kafka

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dockerfile-single-kafka

MIT License Docker Pulls

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.

Supported tags

tcnksm/single-kafka image support below tags. Link is its Dockerfile.

Tag is correspond to ${SCALA_VERSION}-${KAFKA_VERSION}.

Usage

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.

Testing

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

Contribution

  1. Fork (https://github.com/tcnksm/dockerfile-single-kafka/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Push it to your remote repository
  6. Create new Pull Request

Author

Taichi Nakashima

About

Dockerfile for single node kafka

License:MIT License


Languages

Language:Shell 100.0%