"No route to host" trying to connect to Docker container at 172.17.0.2

I have some issues using Docker in Travis: contrary to my local environment, http requests on the 172.17.0.2 provoked “no route to host” if I let default docker network configuration. So I begun to play with it looking for one working with my integration tests, host didn’t work, bridge produced connection refused.

Before playing the ports I tried an nmap on my container and, since this moment, I cannot run any new test (even with nmap removed).

Here is my last autorized run: https://travis-ci.org/jclaveau/docker-php-multiversion/jobs/643852655

I still have some strategies to check (e.g. update docker), patching my code to specify the opened ports (this would be a big change only to debug Travis specific issue so i’d like to avoid it), have more imagination…

But I’m stuck now and am forced to ask you for help.

Thanks in advance,
Jean

PS : I also tried a while to use travis-build to run Travis locally but without success

AFAICS searching https://docs.docker.com, the 1st container having 172.17.0.2 is not a guarantee, and neither is it a guarantee that that address is accessible from the host.

Container networking | Docker Documentation mentions that the default bridge is deliberately protected with iptables rules and suggests connecting to containers from the outside via published ports.