Run Kafdrop with Docker using Secure Connection
masterYou can run Kafdrop via Docker using two methods for secure connections:
Method 1: Base64 Encoded Environment Variables
Pass the contents of your properties and certificate files as base64-encoded strings via environment variables.
Method 2: Mounting Files
Mount your local kafka.properties, kafka.truststore.jks, and kafka.keystore.jks files into the container and use the _FILE environment variables to point to their internal paths.
# Method 1: Base64
docker run -d --rm -p 9000:9000 \
-e KAFKA_BROKERCONNECT=<host:port,host:port> \
-e KAFKA_PROPERTIES="$(cat kafka.properties | base64)" \
-e KAFKA_TRUSTSTORE="$(cat kafka.truststore.jks | base64)" \
-e KAFKA_KEYSTORE="$(cat kafka.keystore.jks | base64)" \
obsidiandynamics/kafdrop
# Method 2: File Mounting
docker run -d --rm -p 9000:9000 \
-v $(pwd)/kafka.properties:/tmp/kafka.properties:ro \
-v $(pwd)/kafka.truststore.jks:/tmp/kafka.truststore.jks:ro \
-v $(pwd)/kafka.keystore.jks:/tmp/kafka.keystore.jks:ro \
-e KAFKA_BROKERCONNECT=<host:port,host:port> \
-e KAFKA_PROPERTIES_FILE=/tmp/kafka.properties \
-e KAFKA_TRUSTSTORE_FILE=/tmp/kafka.truststore.jks \
-e KAFKA_KEYSTORE_FILE=/tmp/kafka.keystore.jks \
obsidiandynamics/kafdrop