Dockerize Kafka Streams

Hello frens,
my academic project based on Kafka Streams is almost finished. Now I’m just dockerizing it and found a problem with in memory store RocksDB while dockerizng Kafka Streams client.

java.lang.NoClassDefFoundError: Could not initialize class org.rocksdb.DBOptions

java.lang.UnsatisfiedLinkError: /tmp/librocksdbjni6134306021378652127.so: Error loading shared library libstdc++.so.6: No such file or directory (needed by /tmp/librocksdbjni6134306021378652127.so)

Google says it can be problem with lack of properly installed Microsoft Visual C++.
I use Confluent’s image.
Is it only client issue or something with Confluent’s Kafka image?

Client uses docker-compose based on docker image openjdk:17-alpine:

version: '3.8'
services:
     
  cstream-aggregator:
    image: cstream-aggregator:0.0.6
    container_name: cstream-aggregator
    build:
      context: ./aggregator
      dockerfile: Dockerfile
    volumes:
      - streams:/streams
      
volumes:
  streams:
    external:
      name: docker_streams

and broker docker-compose is:

version: '3.8'
services:

  zookeeper-1:
    image: confluentinc/cp-zookeeper:latest
    container_name: zookeeper-1
    ports:
      - '12181:2181'
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000

  zookeeper-2:
    image: confluentinc/cp-zookeeper:latest
    container_name: zookeeper-2
    ports:
      - '22181:2181'
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
      
  kafka-1:
    image: confluentinc/cp-kafka:latest
    container_name: kafka-1
    ports:
      - '19092:19092'
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-1:9092,PLAINTEXT_HOST://localhost:19092
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    volumes:
      - streams:/streams
    depends_on:
      - zookeeper-1
      - zookeeper-2
      
  kafka-2:
    image: confluentinc/cp-kafka:latest
    container_name: kafka-2
    ports:
      - '29092:29092'
    environment:
      KAFKA_BROKER_ID: 2
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-2:9092,PLAINTEXT_HOST://localhost:29092
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    volumes:
      - streams:/streams
    depends_on:
      - zookeeper-1
      - zookeeper-2
      
volumes:
  streams:

Frens, this looks like problem with client. I have change the image to openjdk:18-slim and now it works

1 Like

Thanks for reporting back and sharing the solution that fixed your problem.