Docker Compose Kafka Zookeeper Setup for Local Development

--

Reading around online blogs and stack overflow articles I came up short on a complete solution or some solutions were too verbose.

Prerequisites:

Yaml file for docker-compose config for a local setup.

services:
# See:
# https://hub.docker.com/r/bitnami/zookeeper
zookeeper:
image: bitnami/zookeeper:3.7.1
container_name: 'zookeeper'
ports:
- 2181:2181
environment:
- ALLOW_ANONYMOUS_LOGIN=yes

# See:
# https://hub.docker.com/r/bitnami/kafka
kafka:
image: bitnami/kafka:3.4.0
container_name: 'kafka'
ports:
- 9092:9092
environment:
- KAFKA_BROKER_ID=1
- KAFKA_LISTENERS=PLAINTEXT://:9092
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://10.5.0.1:9092
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
depends_on:
- zookeeper

This solution isn’t suited for production.

--

--