Skip to content

Instantly share code, notes, and snippets.

@colinfwren
Created February 10, 2019 22:32
Show Gist options
  • Save colinfwren/b653cae4c900479c34c160396b00442e to your computer and use it in GitHub Desktop.
Save colinfwren/b653cae4c900479c34c160396b00442e to your computer and use it in GitHub Desktop.
Getting the host's IP in a Makefile to populate into a docker-compose file
#!/usr/bin/make
run:
HOST_IP=$(shell ifconfig en0 | grep inet | grep -v inet6 | awk '{print $$2}') docker-compose -f confluent.yml up -d
# In your docker-compose file you can use something like:
# version: '3'
# services:
# zookeeper:
# image: confluentinc/cp-zookeeper:5.1.0
# environment:
# - ZOOKEEPER_CLIENT_PORT=2181
# ports:
# - 2181:2181
#
# kafka:
# image: confluentinc/cp-kafka:5.1.0
# environment:
# - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
# - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://${HOST_IP}:9092
# - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
# depends_on:
# - zookeeper
# ports:
# - 9092:9092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment