Skip to content

Instantly share code, notes, and snippets.

@sina-salahshour
Last active January 14, 2023 18:50
Show Gist options
  • Select an option

  • Save sina-salahshour/cd596533b6ad7969dfa8f8e8385c885a to your computer and use it in GitHub Desktop.

Select an option

Save sina-salahshour/cd596533b6ad7969dfa8f8e8385c885a to your computer and use it in GitHub Desktop.
kafka docker file for nestjs
# https://kafka.js.org/docs/running-kafka-in-development
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper:latest
ports:
- 2181:2181
volumes:
- ./_data/zookeeper/data:/data
kafka:
image: wurstmeister/kafka:2.12-2.5.0
hostname: kafka
#container_name: kafka
ports:
- 9092:9092
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: LISTENER_DOCKER_INTERNAL://:19092,LISTENER_DOCKER_EXTERNAL://:9092
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka:19092,LISTENER_DOCKER_EXTERNAL://127.0.0.1:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_BROKER_ID: 1
KAFKA_CREATE_TOPICS: __consumer_offsets:50:1,user.create:1:1
volumes:
- ./_data/kafka/data:/var/lib/kafka/data
depends_on:
- zookeeper
networks:
elastic:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment