This Kafka docker uses pure apache kafka source.
The purpose of this image is to run in kraft mode aka kafka with Raft, though it's possible to use zk, by using
different configs or replacing the entrypoint, but that's not the scope of this development.
The singleton mode uses default values, since it's usually for test environments, but you can also override such configs, as mentioned in the configuration section below
docker run -it --hostname kafka-0 memoriaio/kafka-docker:3.2.0Cluster mode in kraft has two types of instances, aka two configurations one for controller.properties and another for broker. broker.properties
docker compose upEnvironment variables:
CONFIG_TMPLdirectory has default value/default_tmpl/singleton.propertieswhich is for singleton mode, when using cluster mode make sure to choose controller or broker as used in the docker-compose fileKAFKA_CLUSTER_UUIDhas default valueDEFUALT00000000000UUID- To generate UUID for the cluster use the following script, and make sure the uuid is same for all containers
export KAFKA_CLUSTER_UUID=$(./kafka/bin/kafka-storage.sh random-uuid)Very similar to bash interpolation e.g ${variable_name} you'll be able to interpolate all system env vars to the
final output.
How it works is basically the main script uses gnu gettext envsubst < CONFIG_TMPL >> $GENERATED_CONFIG to generate the
final configuration file.