- How to run Kafka with Docker Compose
- How to execute Kafka commands against a Docker cluster
- How to manage your Docker-based Kafka environment
Install Docker
| Platform | Installation |
|---|---|
| Mac | Docker Desktop for Mac |
| Windows | Docker Desktop for Windows |
| Linux | Docker Engine (choose your distro) |
Run Kafka with Docker Compose
Docker Compose runs multi-container applications. Each Kafka component (ZooKeeper, broker) runs in a separate container. Step 1: Clone the repository| File | Configuration |
|---|---|
zk-single-kafka-single.yml | One ZooKeeper, one broker (learning) |
zk-single-kafka-multiple.yml | One ZooKeeper, multiple brokers |
zk-multiple-kafka-multiple.yml | Multiple ZooKeeper, multiple brokers |
localhost:9092.
Run Kafka commands
You have two options for running Kafka CLI commands:Option 1: Run inside the container
.sh extension:
Option 2: Run from your host machine
Install the Kafka binaries on your system (skip the steps for starting ZooKeeper and Kafka):- Mac (follow the whole document except starting Kafka and ZooKeeper)
- Linux (follow the whole document except starting Kafka and ZooKeeper)
- Windows (follow the whole document except starting Kafka and ZooKeeper)
.sh extension:
Stop and clean up
Stop containers (preserves data):See it in practice with ConduktorConduktor Console can connect to your Docker-based Kafka cluster at
localhost:9092 for visual management of topics and messages.Next steps
- CLI tutorials to practice Kafka commands
- Kafka fundamentals to understand core concepts
- Start programming with Kafka clients