Resolves prometheus/node_exporter#585 (#586)

* Resolves prometheus/node_exporter#585

* - removed 'docker rm' as it is not allowed on CircleCI
See discussion: https://discuss.circleci.com/t/docker-error-removing-intermediate-container/70
This commit is contained in:
fahlke 2017-07-07 07:26:11 +02:00 committed by Ben Kochie
parent 8d90276283
commit a89d72b5eb

View file

@ -4,20 +4,27 @@ set -exo pipefail
docker_image=$1 docker_image=$1
port=$2 port=$2
container_id=''
wait_start() { wait_start() {
for in in {1..10}; do for in in {1..10}; do
if /usr/bin/curl -s -m 5 -f "http://localhost:${port}/metrics" > /dev/null ; then exit 0 ; if /usr/bin/curl -s -m 5 -f "http://localhost:${port}/metrics" > /dev/null; then
else docker_cleanup
sleep 1 exit 0
fi else
sleep 1
fi
done done
exit 1 exit 1
} }
docker_start() { docker_start() {
docker run -d -p "${port}":"${port}" "${docker_image}" container_id=$(docker run -d -p "${port}":"${port}" "${docker_image}")
}
docker_cleanup() {
docker kill "${container_id}"
} }
if [[ "$#" -ne 2 ]] ; then if [[ "$#" -ne 2 ]] ; then