How to Setup Kafka Broker Locally using Docker

A Step-by-Step Guide to Effortless Broker Setup

Fahmi Nurfikri
Thoughtful Shower


In modern software development, efficient data processing and communication are essential. Apache Kafka, a distributed streaming platform, has emerged as a powerful tool for managing and processing real-time data streams. Whether you’re an experienced developer or just starting your journey in the world of software engineering, setting up a Kafka broker locally using Docker is an excellent way to explore and experiment with this powerful platform.

In this simple article, we will set up a Kafka broker on our local machine using Docker.

Why Docker?

Docker provides a lightweight and portable way to run applications in an isolated environment. It is an ideal choice for quickly getting Kafka up and running without the hassle of complicated installations.

So, Let’s get started.

The initial step involves launching a Zookeeper server to initiate an Apache Kafka server.

We can configure this dependency in a docker-compose.yml file. Let’s create a simple docker-compose.yml file with two services, namely Zookeeper and Kafka.

version: '2'
image: confluentinc/cp-zookeeper:latest