The provided examples of Kafka with Docker are incomplete. It is quite cumbersome to debug the docker compose file since there are a lot of variables involved. Additionally, the thrown exceptions while trying to connect to the Kafka are not very clear. Kafka only accepts SSL Truststore and SSL Keystore which can further the complexity of the configuration.
Note: this should NOT be used in production environment.
When using Kafka in a local (dev) environment, you might want to use PLAINTEXT as your authentication method. The following command can be used:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
docker compose -f docker-compose.yml -f docker-compose.prod.yml up --build
Note: provide the name/password for Kafka set in the .env file. Note: the {{TRUSTSTORE_LOCATION}}, {{YOUR_CERTIFICATES_LOCATION_HERE}}, {{KEYSTORE_FILENAME}}, {{TRUSTSTORE_FILENAME}}, {{YOUR_CERTIFICATES_LOCATION_HERE}} have to be replaced with a hard coded value.
You should now be able to connect to the Kafka UI on localhost with the provided port in the .env
.