0

I have installed kafka on docker with following yml

version: "3"
services:
 zookeeper:
image: 'bitnami/zookeeper:latest'
ports:
  - '2181:2181'
environment:
  - ALLOW_ANONYMOUS_LOGIN=yes
 kafka:
image: 'bitnami/kafka:latest'

ports:
  - '9092:9092'
  - '9093:9093'
environment:
  - KAFKA_BROKER_ID=1
  - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true
  - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT,EXTERNAL:PLAINTEXT
  - KAFKA_CFG_LISTENERS=CLIENT://:9092,EXTERNAL://:9093
  - KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:9092,EXTERNAL://myserver.com:9093
  - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
  - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
  - ALLOW_PLAINTEXT_LISTENER=yes
depends_on:
  - zookeeper

i installed kafkacat on machine (linux on wsl2),dockerapp_zookeeper_1 is container for zookeper, and trying to run

docker exec -t dockerapp_zookeeper_1 \
 zookeeper-shell.sh \
   localhost:2181 \
   ls /brokers/ids

i am getting error

OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "zookeeper-shell.sh": executable file not found in $PATH: unknown

file is there i checked , why i am getting this error, do i need to install kafkacat on docker itself ?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
murmansk
  • 845
  • 2
  • 11
  • 28

1 Answers1

0

Your error has nothing to do with kcat.

You'll need to provide the absolute path to the Zookeeper shell script, which I believe is under /opt in that container, or try without .sh

If you actually wanted to use kcat, that has nothing to do with Zookeeper, and, no, doesn't need its own container. You'd run it with kcat, not docker exec

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245