I don’t find an all-in-one image for Kafka 2.0+ in https://hub.docker.com, the only one from spotify/kafka supports Kafka 0.10 only which is an very old version.
In github repository, a modified version is provided in #92. You can download and follow the steps to create your own image. I publish one image with Kafka 2.0.0 in dockerhub, and start an Kafka 2.0.0 instance quickly.
- docker image
The URL is https://hub.docker.com/r/mingmin/kafka; - start an instance with docker cli
docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost mingmin/kafka:latest
ADVERTISED_HOST is required, I push localhost here for local test only. Use your accessible host name to expose the Kafka instance.
We’re done now, a Kafka 2.0.0 instance(broker localhost:9092, zookeeper localhost:2181) is ready to use.