Tested in image: confluentinc/cp-kafka:8.1.0
healthcheck:
test: /bin/kafka-topics --bootstrap-server localhost:9092 --list | grep -E '<your topic 1>| <your topic 2> | etc.' &> /dev/null
start_period: 60s
interval: 20s
timeout: 5s
retries: 5