我已经在docker上安装了Kafka,并使用了以下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
我在机器上安装了kafkacat(wsl2上的linux),dockerapp_zookeeper_1是zookeper的容器,并尝试运行
docker exec -t dockerapp_zookeeper_1 \
zookeeper-shell.sh \
localhost:2181 \
ls /brokers/ids
我得到错误
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
文件在那里我检查了,为什么我得到这个错误,我需要安装kafkacat在docker本身?
1条答案
按热度按时间ergxz8rk1#
您的错误与kcat无关。
您需要提供Zookeeper shell脚本的绝对路径,我相信它在该容器的/opt下,或者尝试不使用
.sh
如果您真的想使用kcat,那与Zookeeper无关,而且,不,不需要它自己的容器。