Skip to content

Instantly share code, notes, and snippets.

@alucard001
Last active February 19, 2023 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alucard001/bedcca6d6680dcf2600d7453d206106d to your computer and use it in GitHub Desktop.
Save alucard001/bedcca6d6680dcf2600d7453d206106d to your computer and use it in GitHub Desktop.
Docker compose for Kafka + Zookeeper + Kafka UI - Just work!
# Just run `docker compose up --build` to build and run these containers
# To access the UI go to http://localhost
# While I haven't REALLY use program to access producer/consumer, you can use the Python wrapper
# provided by Confluent: https://developer.confluent.io/get-started/python/#introduction
# to get start
version: "3"
services:
zookeeper:
image: docker.io/bitnami/zookeeper:3.8
ports:
- "2181:2181"
volumes:
- "zookeeper_data:/bitnami"
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
image: docker.io/bitnami/kafka:3.3
ports:
- "8082:8082"
# - "9092:9092"
- "29092:29092"
volumes:
- "kafka_data:/bitnami"
environment:
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
# https://www.confluent.io/blog/kafka-listeners-explained/
- KAFKA_LISTENERS=PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
- KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
- KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME=false
- ALLOW_PLAINTEXT_LISTENER=yes
- KAFKA_REST_LISTENERS=http://localhost:8082
depends_on:
- zookeeper
kafka-ui:
image: provectuslabs/kafka-ui
container_name: kafka-ui
ports:
- "80:8080"
restart: always
environment:
- KAFKA_CLUSTERS_0_NAME=local
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092
depends_on:
- kafka
volumes:
zookeeper_data:
driver: local
kafka_data:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment