Skip to main content

Command Palette

Search for a command to run...

How to start a Confluent Kafka Development Server along with Provectus' Kafka Management Web Interface using a Docker Compose File

Updated
2 min read

Define compose file for kafka coupled with zookeeper. Join them in a docker network element and provide the network a unique name. The name app-network is used in this article. Run this compose file to start Kafka Development Server.

services:
  zookeeper:
    image: confluentinc/cp-zookeeper:7.6.1
    container_name: zookeeper
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
    networks:
      - app-network

  kafka:
    image: confluentinc/cp-kafka:7.6.1
    container_name: kafka
    ports:
      - "9092:9092"
    environment:
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
      KAFKA_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://kafka:9092
      KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    depends_on:
      - zookeeper
    networks:
      - app-network

networks:
  app-network:
    name: app-network
    driver: bridge

List networks managed by docker engine. Ensure that the network you have defined is listed.

C:\some\path>podman network ls
NETWORK ID    NAME                              DRIVER
ba0ccfa0295b  app-network                       bridge

Define another compose file for kafka-ui. Specify the network you have defined earlier as an external network here and join kafka-ui service with it. Run this compose file to start Provectus' Kafka Management Web Interface.

services:
  kafka-ui:
    container_name: kafka-ui
    image: provectuslabs/kafka-ui:v0.7.2
    ports:
      - 8080:8080
    environment:
      DYNAMIC_CONFIG_ENABLED: 'true'
      KAFKA_CLUSTERS_0_NAME: local
      KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
    networks:
      - app-network

networks:
    app-network:
        name: app-network
        external: true

Done!

Kafka listener will be accessible on host machine at localhost:9092 and this address must be used as bootstrap server(s) for your application running in host machine. Web interface to manage kafka will be accessible from web browser at localhost:8080 .

Footnotes

At the time of writing this article, I have used Compose V2 specification to define compose files and Podman v5.0.1 to run compose files. A desktop running Windows 11 was used as host machine.

References