Skip to content

Instantly share code, notes, and snippets.

@dimitraz
Created June 26, 2017 16:03
Show Gist options
  • Save dimitraz/9d628978794fee024a5e3c3711cef1d0 to your computer and use it in GitHub Desktop.
Save dimitraz/9d628978794fee024a5e3c3711cef1d0 to your computer and use it in GitHub Desktop.
Kafka bootstrap servers
#!/bin/bash
if [ -z "$1" ]; then
CONTAINER_PORT="9092"
else
CONTAINER_PORT=$1
fi
# Get the Kafka container IP
if [[ "$OSTYPE" == "linux-gnu" ]]; then
CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' kafka)
elif [[ "$OSTYPE" == "darwin"* ]]; then
CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' kafka)
sudo ifconfig lo0 alias $CONTAINER_IP
fi
# Create the config file
echo $CONTAINER_IP:$CONTAINER_PORT > server.properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment