A lightweight toolkit to run Apache Kafka and Zookeeper locally using Docker Compose, with easy start/stop/status scripts.
kafka-toolbox/
├── one-time-setup.sh # One-time setup: fixes permissions for all scripts
├── start-kafka.sh # Start Kafka + Zookeeper
├── stop-kafka.sh # Stop Kafka + Zookeeper
├── status-kafka.sh # Check if containers are running
├── config/
│ ├── local.env # Kafka & Zookeeper versions and config
│ └── docker-compose.yml # Docker Compose file for Kafka + Zookeeper
└── util/
├── docker/
│ └── docker-setup.sh # Check Docker installation and daemon
└── kafka/
└── kafka-setup.sh # Pull Kafka & Zookeeper images if needed
- Linux system
- Docker
- Docker Compose (V2 plugin included in Docker)
The scripts include checks for Docker installation and daemon.
Run the setup script once to fix permissions for all scripts:
chmod +x one-time-setup.sh
./one-time-setup.shThis ensures you can run all scripts without permission issues.
Edit config/local.env to set your desired Kafka & Zookeeper versions:
KAFKA_VERSION=4.1.1
ZOOKEEPER_VERSION=3.9.0
DOCKER_NETWORK=kafka-network./start-kafka.shExpected output:
✅ Docker is available and running.
✅ Kafka Docker image already exists
✅ Zookeeper Docker image already exists
✅ Kafka environment is ready!
📦 Starting Kafka using docker compose...
✅ Kafka started successfully!
📡 Brokers running on: localhost:9092
./stop-kafka.shExpected output:
📦 Stopping Kafka using docker compose...
✅ Kafka and Zookeeper stopped successfully!
./status-kafka.shOutput:
✅ Kafka container is running: kafka
✅ Zookeeper container is running: zookeeper
util/docker/docker-setup.sh→ Checks Docker installation & daemon.util/kafka/kafka-setup.sh→ Pulls Kafka & Zookeeper images if not present.