Turns out it was just a matter of waiting for the containers to finish starting up before attempting the tests. Using docker
as hostname and adding a repeated health check to make sure the tests only begin when the container is ready solved the issue.
Example command in before_script
that accomplishes this:
- >
i=1; while [ $i -le 15 ]; do
curl -v http://docker:8000/health && break || sleep 1;
if [ $i -eq 15 ]; then exit 1; fi;
i=$((i + 1));
done