format kafka cluster in entrypoint

This commit is contained in:
Adam 2022-06-24 14:49:52 +02:00
parent 62f37353ba
commit b155bb8bc1
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,6 @@
./bin/kafka-storage.sh format \
--ignore-formatted \
--config ./server.properties \
--cluster-id "$(cat cluster_id)"
./bin/kafka-server-start.sh ./server.properties

View file

@ -32,10 +32,11 @@ VOLUME /tmp/kraft-combined-logs
EXPOSE 9092 9093
# Generate a cluster ID (must use this .sh to generate a UUID)
RUN echo "$(./bin/kafka-storage.sh random-uuid)" > cluster_id \
RUN ./bin/kafka-storage.sh random-uuid > cluster_id \
&& echo "Generated a Kafka Cluster ID: $(cat cluster_id)"
COPY ./kafka-server.properties ./server.properties
COPY ./entrypoint.sh ./entrypoint.sh
# Format storage directories
RUN ./bin/kafka-storage.sh format \
@ -44,7 +45,7 @@ RUN ./bin/kafka-storage.sh format \
--cluster-id "$(cat cluster_id)"
# launch the broker in KRaft mode, which means that it runs without ZooKeeper
ENTRYPOINT ["./bin/kafka-server-start.sh", "./server.properties"]
ENTRYPOINT ["./entrypoint.sh"]
### Kafka Connect ##