- You will need
envsubst
. On macOS, install it withbrew
brew install gettext
brew link --force gettext
- You need to get your host IP and use it in
docker-compose.yml
(KAFKA_ADVERTISED_HOST_NAME). In my case on macOS my docker is onen1
:
host_ip=$(ipconfig getifaddr en1) envsubst < docker-compose.yml.template > docker-compose.yml
- producer.js and consumer.js must have $host_ip for
brokers
:
host_ip=$(ipconfig getifaddr en1) envsubst < producer.js.template > producer.js
host_ip=$(ipconfig getifaddr en1) envsubst < consumer.js.template > consumer.js
- If you have older version of docker, you have to create
kafka
network first:
docker network create kafka
- Run it:
docker-compose up -d
- Get logs from container
..* Get the list of all running containers with docker-compose ps
..* Get logs from single container: docker-compose logs -f CONTAINER_NAME
..* Get logs from single all of them: docker-compose logs -f