$ docker run --rm -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 spotify/kafka
- Download Kafka binary
# list existing topics
$ ./bin/kafka-topics.sh --list --zookeeper localhost:2181
# create topic "test"
$ ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
# consume messages for the topic "test"
$ ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-biginning
https://kafka-python.readthedocs.io/en/master/usage.html