Browse Source

fix: ``wait_for_tcp_port`` would not work as expected and always succeed.

``$DEFAULT_BASH_IMAGE`` would not be set (because not exported) and as consequence
the ``docker run`` would fail with an errorlevel different from 1. The failure
condition was bogus here, and we should not rely on ``$DEFAULT_BASH_IMAGE`` to be
exported. Both have been corrected.
test
Valentin Lab 6 years ago
parent
commit
5c64645648
  1. 5
      bin/compose-core

5
bin/compose-core

@ -695,11 +695,12 @@ wait_docker_ip() {
}
export -f wait_docker_ip
DEFAULT_BASH_IMAGE=${DEFAULT_BASH_IMAGE:-docker.0k.io/bash}
wait_for_tcp_port() {
local network=$1 host_port=$2 timeout=20
verb "Trying to connect to $host_port"
docker run --rm -i --network "$network" "$DEFAULT_BASH_IMAGE" <<EOF
bash_image=${DEFAULT_BASH_IMAGE:-docker.0k.io/bash}
echo docker run --rm -i --network "$network" "$bash_image" >&2
docker run --rm -i --network "$network" "$bash_image" <<EOF
start=\$SECONDS
while true; do
timeout 1 bash -c "</dev/tcp/${host_port/://}" >/dev/null 2>&1 && break

Loading…
Cancel
Save