https://github.com/thebinary/docker-kafka
Kafka Docker
https://github.com/thebinary/docker-kafka
dockerfile kafka kafka-server vanilla
Last synced: about 2 months ago
JSON representation
Kafka Docker
- Host: GitHub
- URL: https://github.com/thebinary/docker-kafka
- Owner: thebinary
- Created: 2021-01-12T11:56:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T04:51:09.000Z (almost 5 years ago)
- Last Synced: 2025-08-19T02:43:18.322Z (8 months ago)
- Topics: dockerfile, kafka, kafka-server, vanilla
- Language: Dockerfile
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Apache Kafka in Docker #
__TAG names are based on Kafka binaries version as__
thebinary/kafka:{scala_version}-{kafka_version}
eg: __thebinary/kafka:2.13-2.7.0__
## Use as Kafka Server
1. Run a zookeeper service
Kafka is dependent on zookeeper service.
```sh
docker run -d -it --network kafka --name zookeeper zookeeper
```
2. Create a server.properties config file
```
# server.properties
broker.id=0
listeners=PLAINTEXT://:9092
log.dirs=/tmp/kafka-logs
num.partitions=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
zookeeper.connect=zookeeper:2181
```
3. Run kafka
```sh
docker run --network kafka -it -d -v $(PWD)/server.properties:/etc/kafka/config/server.properties thebinary/kafka
```
## Use as Kafka Tools
All kafka shell tools (scripts) can be used directly from these docker images. This can be used to run these kafka tools to interact with external kafka-brokers/kafka-zookeepers. Some examples are given below:
1. Create Kafka Topic
```
docker run --rm -it thebinary/kafka kafka-topics.sh --bootstrap-sever ext-kafka-01.thebinary.org --create --replication-factor 1 --partitions 1 --topic kafkatopic
```
2. List Kafka Topics
```
docker run --rm -it thebinary/kafka kafka-topics.sh --bootstrap-sever ext-kafka-01.thebinary.org --list
```