This repository was archived by the owner on Jun 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,20 @@ export DOCKER_HOST_IP=$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}')
143143# export CONTAINER_IP=$(ip addr show dev ${ETHERNET_DEVICE_NAME} | grep "inet " | awk '{print $2}' | cut -d '/' -f 1)
144144# 2017-09 Found a more portable, even works in alpine:
145145export CONTAINER_IP=` getent hosts ${HOSTNAME} | awk ' { print $1 }' `
146+ # Trying again to retrieve the container IP when using Zalenium
147+ if [ " ${ZALENIUM} " == " true" ] && [ " ${CONTAINER_IP} " == " " ]; then
148+ # Sometimes the networking is not fast and the container IP is not there, we retry a few times for one minute to get it.
149+ echo " Retrying to get CONTAINER_IP..." 1>&2
150+ WAIT_UNTIL=$(( SECONDS + 60 ))
151+ while [ $SECONDS -lt ${WAIT_UNTIL} ]; do
152+ export CONTAINER_IP=` getent hosts ${HOSTNAME} | awk ' { print $1 }' `
153+ if [ " ${CONTAINER_IP} " != " " ]; then
154+ break
155+ fi
156+ echo -n ' .'
157+ sleep 2
158+ done
159+ fi
146160
147161# if [ "${DOCKER_HOST_IP}" == "" ] || [[ ${DOCKER_HOST_IP} == 127* ]]; then
148162# # TODO: Try with an alternative method
You can’t perform that action at this time.
0 commit comments