finds.dev← search

// the find

wurstmeister/kafka-docker

★ 6,956 · Shell · Apache-2.0 · updated May 2024

Dockerfile for Apache Kafka

A Dockerfile and startup scripts that run Apache Kafka in a container, configured through KAFKA_* environment variables rather than hand-edited server.properties. It suits people who want a single broker or a small local cluster under docker-compose for development, tests, or a quick staging setup. Most of its reach comes from being the image people found first, and the repo itself shows little recent work.

- The config mapping is simple. Any KAFKA_FOO_BAR variable becomes foo.bar in server.properties, and LOG4J_* does the same for log4j, so most broker settings can be changed without rebuilding the image.

- Advertised-listener handling covers the awkward cases. HOSTNAME_COMMAND and PORT_COMMAND can be interpolated into other KAFKA_* values, so a cloud metadata address or a docker port lookup can feed the listener config at startup.

- Broker IDs can be generated from the container hostname, which lets docker-compose scale work without manual ID bookkeeping. KAFKA_CREATE_TOPICS packs partitions, replicas, and cleanup.policy into one env string.

- The test directory is real. It has per-version scripts under test/0.0, test/0.9, and test/0.10, plus a JMX scenario, so the config paths have been run against older Kafka releases.

- The last push was May 2024. The README still points at Travis, microbadger, and the docker-compose v1 scale command. Check the commit history before depending on it for anything new.

- Config works by rewriting environment variable names in shell. The README describes no validation, so a misspelled KAFKA_ variable quietly produces a wrong or unused broker property.

- The README never mentions KRaft mode, which is how current Kafka runs without ZooKeeper. Confirm that before adopting this for a new cluster. Apache publishes its own apache/kafka image, and that is the first thing to compare against.

- The advertised-host and port setup depends on shell commands evaluated inside the container. The README links a separate Connectivity wiki page, which is a sign that a broker that starts but can't be reached from the host is the most common way this goes wrong.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →