启动脚本
sed -i -r "s/[0-9]{1,3}(\.[0-9]{1,3}){3}/$(ifconfig $(ip route show default |head -1 |awk '{print $5}') |grep -oP '(?<=inet\s)\d+(\.\d+){3}')/g" docker-compose.yml
docker-compose up -d
docker-compose.yml
version: '3.9'
services:
zookeeper:
image: 'bitnami/zookeeper:3.7.2'
container_name: zookeeper
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
- TZ=Asia/Shanghai
kafka:
image: 'bitnami/kafka:3.2.3'
container_name: kafka
ports:
- '9092:9092'
environment:
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
# - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://${KAFKA_ADVERTISED_IP}:9092
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
- TZ=Asia/Shanghai
depends_on:
- zookeeper
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- '9090:8080'
environment:
- DYNAMIC_CONFIG_ENABLED=true
- KAFKA_CLUSTERS_0_NAME=local_kafka
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092
- TZ=Asia/Shanghai
depends_on:
- kafka
标签:compose,PLAINTEXT,CFG,zookeeper,9092,KAFKA,docker,kafka
From: https://www.cnblogs.com/cheap-cabbage/p/17864138.html