Kafka:
以kafka3.4.0 Kraft模式为例:
- 首先执行./bin/kafka-storage.sh random-uuid生成一个随机的UUID
- 执行./bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.properties
- Dockerfile文件内容:
FROM openjdk:11 USER root COPY ./config /config COPY ./data /data COPY ./kafka/ /kafka EXPOSE 9092 EXPOSE 9093 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN echo 'Asia/Shanghai' >/etc/timezone ENTRYPOINT ["sh","/kafka/start.sh"]
start.sh内容(把config和data放到根目录主要是为了容器卷映射出来) - 执行docker build -f Dockerfile -t 47.108.149.159:9001/dtm-component/kafka:3.4.0 .
- 执行docker push 47.108.149.159:9001/dtm-component/kafka:3.4.0