Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions bin/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ export DOCKER_HOST_IP=$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}')
# export CONTAINER_IP=$(ip addr show dev ${ETHERNET_DEVICE_NAME} | grep "inet " | awk '{print $2}' | cut -d '/' -f 1)
# 2017-09 Found a more portable, even works in alpine:
export CONTAINER_IP=`getent hosts ${HOSTNAME} | awk '{ print $1 }'`
# Trying again to retrieve the container IP when using Zalenium
if [ "${ZALENIUM}" == "true" ] && [ "${CONTAINER_IP}" == "" ]; then
# Sometimes the networking is not fast and the container IP is not there, we retry a few times for one minute to get it.
echo "Retrying to get CONTAINER_IP..." 1>&2
WAIT_UNTIL=$((SECONDS + 60))
while [ $SECONDS -lt ${WAIT_UNTIL} ]; do
export CONTAINER_IP=`getent hosts ${HOSTNAME} | awk '{ print $1 }'`
if [ "${CONTAINER_IP}" != "" ]; then
break
fi
echo -n '.'
sleep 2
done
fi

# if [ "${DOCKER_HOST_IP}" == "" ] || [[ ${DOCKER_HOST_IP} == 127* ]]; then
# # TODO: Try with an alternative method
Expand Down