explaingit

wurstmeister/kafka-docker

6,973ShellAudience · ops devopsComplexity · 3/5Setup · moderate

TLDR

A Docker image that packages Apache Kafka so you can run a message-broker cluster on any machine using a single docker-compose command, with all Kafka settings configured through environment variables.

Mindmap

mindmap
  root((repo))
    What it does
      Run Kafka in Docker
      Scale brokers
      Auto-create topics
    Configuration
      Env vars only
      Listener protocols
      Log4j settings
    Use cases
      Local Kafka testing
      Multi-broker cluster
      Cloud deployment
    Gotchas
      Networking setup
      Advertised hostname
    Audience
      DevOps engineers
      Backend developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run a local Kafka cluster for testing event-driven applications without a manual Kafka install.

USE CASE 2

Scale a multi-broker Kafka cluster up or down with a single docker-compose scale command.

USE CASE 3

Configure Kafka options like max message size or topic auto-creation through environment variables in a Compose file.

USE CASE 4

Set up automatic topic creation at startup with specific partition counts and replica factors.

Tech stack

DockerApache KafkaShelldocker-compose

Getting it running

Difficulty · moderate Time to first run · 30min

Networking is the trickiest part, the advertised hostname must be set to your host IP for clients outside Docker to connect.

In plain English

This repository provides a Docker image for running Apache Kafka, a system used to pass large volumes of messages between applications reliably and at high speed. Docker is a tool that packages software into containers so it runs consistently regardless of where you deploy it. Kafka itself is often described as a message broker: applications send data to it, other applications read that data, and Kafka manages the flow between them. The image is published on Docker Hub and can be pulled directly. To run a basic Kafka cluster on your own machine, you edit a configuration file to set your host's IP address, then start everything with a single docker-compose command. You can also scale up to multiple brokers with one more command, or tear the whole cluster down just as easily. Configuration is done through environment variables rather than editing config files inside the container. If you want to change a Kafka setting, you prefix it with KAFKA_ in your docker-compose file and the image applies it automatically. For example, setting KAFKA_MESSAGE_MAX_BYTES adjusts the maximum message size, and setting KAFKA_AUTO_CREATE_TOPICS_ENABLE to false prevents Kafka from creating topics on its own. You can also have the image create topics automatically at startup by specifying names, partition counts, and replica counts in a single environment variable. Networking is the trickiest part of running Kafka in Docker, and the README calls this out explicitly, pointing to a separate wiki page dedicated to connectivity. The advertised hostname, which tells Kafka clients how to reach the broker, can be set directly or computed from a shell command, which is useful when running in cloud environments where IP addresses are assigned dynamically. The project also supports configuring broker IDs, logging behavior via log4j, and listener protocols. A single-broker configuration file is included for simpler local setups.

Copy-paste prompts

Prompt 1
I want to run Apache Kafka locally with wurstmeister/kafka-docker. Give me a minimal docker-compose.yml and the commands to start it and verify a message flows between producer and consumer.
Prompt 2
My Kafka Docker container is not reachable from my client app on the same host. Walk me through the networking and advertised hostname fix for wurstmeister/kafka-docker.
Prompt 3
How do I set KAFKA_MESSAGE_MAX_BYTES and KAFKA_AUTO_CREATE_TOPICS_ENABLE=false in a docker-compose file using the wurstmeister kafka-docker image?
Prompt 4
Show me how to scale the wurstmeister/kafka-docker cluster to 3 brokers and then tear the whole cluster down cleanly.
Open on GitHub → Explain another repo

← wurstmeister on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.