Skip to content

Commit

Permalink
Use the builder image to detect whether we _can_ ping (QEMU user-mode…
Browse files Browse the repository at this point in the history
… networking, etc)
  • Loading branch information
tianon committed Jan 22, 2018
1 parent 7680a63 commit f2583bd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,23 @@ for version in "${versions[@]}"; do
docker run --rm "$base$version-builder" tar cC rootfs . | xz -z9 > "$version/busybox.tar.xz"
docker build -t "$base$version-test" "$version"
docker run --rm "$base$version-test" sh -xec 'true'
if ! docker run --rm "$base$version-test" ping -c 1 google.com; then
sleep 1
docker run --rm "$base$version-test" ping -c 1 google.com

# detect whether the current host _can_ ping
# (QEMU user-mode networking does not route ping traffic)
shouldPing=
if docker run --rm "$base$version-builder" ping -c 1 google.com &> /dev/null; then
shouldPing=1
fi

if [ -n "$shouldPing" ]; then
if ! docker run --rm "$base$version-test" ping -c 1 google.com; then
sleep 1
docker run --rm "$base$version-test" ping -c 1 google.com
fi
else
docker run --rm "$base$version-test" nslookup google.com
fi

docker images "$base$version-test"
)
done

0 comments on commit f2583bd

Please sign in to comment.