Sign inSign up

bsideup/kafka-compose:latest

Manifest digest

sha256:4a46867f9a7faa85175a82330566b8f58aa6109cfe8e5fffa16dac6b21067ae9

Last pushed

over 1 year by bsideup

Type

Compose

Manifest digest

sha256:4a46867f9a7faa85175a82330566b8f58aa6109cfe8e5fffa16dac6b21067ae9

Compose file content

services:
  kafka:
    image: confluentinc/cp-kafka:7.9.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    user: root
    ports:
      - "0:9092"
    environment:
      KAFKA_NODE_ID: 1
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_PROCESS_ROLES: 'broker,controller'
      KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
      KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
      KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
      CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk'
    entrypoint: /bin/bash
    command:
      - -c
      - |
        PORT=$(
          curl -s --unix-socket /var/run/docker.sock http:/v1.32/containers/`hostname`/json \
          | grep -o '"9092/tcp":\[{"HostIp":"0.0.0.0","HostPort":"[0-9]*"}' \
          | grep -o '"HostPort":"[0-9]*"' \
          | cut -d'"' -f4 \
        )
        echo "Running on port $$PORT"

        export KAFKA_CONTROLLER_QUORUM_VOTERS="1@`hostname`:29093"
        export KAFKA_LISTENERS="PLAINTEXT://`hostname`:29092,CONTROLLER://`hostname`:29093,PLAINTEXT_HOST://`hostname`:9092"
        export KAFKA_ADVERTISED_LISTENERS="PLAINTEXT://`hostname`:29092,PLAINTEXT_HOST://localhost:$$PORT"
        /etc/confluent/docker/run

Docker commands

docker compose -f oci://bsideup/kafka-compose:latest up

Use the above command to pull and run the Compose file. Learn more.

Images used

Image + 1 more

Official Confluent Docker Image for Kafka (Community Version)


Pulls

100M+

Stars

542

Last Updated

5 days