各位,我有个问题。我想通过docker-compose创建两个容器,zookeeper和Kafka。我是这样做的:
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
volumes:
- /srv/zookeeper_data:/var/lib/zookeeper/data
- /srv/zookeeper_log:/var/lib/zookeeper/log
kafka:
image: confluentinc/cp-kafka:latest
depends_on:
- zookeeper
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092,PLAINTEXT://192.168.100.9:9092"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
volumes:
- /srv/kafka_data:/var/lib/kafka/data
字符串
执行docker-compose build和docker-compose up时,我在控制台中看到错误:
zookeeper_1 | ===> Running preflight checks ...
zookeeper_1 | ===> Check if /var/lib/zookeeper/data is writable ...
zookeeper_1 | Command [/usr/local/bin/dub path /var/lib/zookeeper/data writable] FAILED !
zookeeper_1 exited with code 1
kafka_1 | ===> Running preflight checks ...
kafka_1 | ===> Check if /var/lib/kafka/data is writable ...
型
上面说了这么多,目录srv/Kafka_data、srv/zookeeper_data和srv/zookeeper_log都存在,怎么办?
1条答案
按热度按时间w80xi6nr1#
我通过将卷路径更改为:
字符串