【发布时间】:2022-01-12 09:16:24
【问题描述】:
我正在尝试连接我的 Kafka 容器和我的 docker 镜像,它们都在本地运行 并且不想使用 Kafka 和 zookeeper 图像创建容器。
当我在不对其进行 dockerizing 的情况下运行应用程序时,它运行良好。
运行 dockerize 应用程序后,显示 docker 日志
could not read message dial tcp 172.21.0.3:9092: i/o timeout
在 Kafka 日志中,它正在显示
kafka-zookeeper-1 | 2021-12-07 06:17:15,755 [myid:1] - WARN [NIOWorkerThread-7:ZooKeeperServer@1411] - Connection request from old client /172.18.0.1:56350; will be dropped if server is in r-o mode
这是用于 kafka 的 docker compose
version: "3"
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
image: 'bitnami/kafka:latest'
ports:
- '9092:9092'
environment:
- KAFKA_BROKER_ID=1
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
depends_on:
- zookeeper
volumes:
- /Users/myuser/docker/volumes/kafka:/var/lib/kafka/data
谁能帮忙,我做错了什么?
【问题讨论】:
-
阅读有关外部和内部客户端的 bitnami 映像自述文件部分。此外,如果您在 Docker 中运行应用程序,则应将其包含在此撰写文件中
标签: docker apache-kafka dockerfile