Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting containers internal ip the easy way #8

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

akomic
Copy link

@akomic akomic commented Oct 29, 2015

Getting containers internal ip the easy way

Alen Komic added 2 commits October 29, 2015 17:34
Getting containers internal ip the easy way
@@ -7,7 +7,7 @@ PUBLISH_NODE_TTL=${PUBLISH_NODE_TTL:-120}
PUBLISH_NODE_POLL=${PUBLISH_NODE_POLL:-60s}

NODE=$(cat /var/lib/rabbitmq/nodename)
HOST_IP=${HOST_IP:-$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')}
HOST_IP=${HOST_IP:-$(hostname -I | tr -d '[[:space:]]')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of using hostname. However, should we just pick the first host
HOST_IP=${HOST_IP:$(hostname -I | awk '{print $1}')} ?

The only case I could see multiple IP address is when we use --net=host. Even in that case, we might just pick the first IP in the list by default. Thoughts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants