No route to host from inside docker container

I am using Traefik with docker compose.

I am able to reach my docker containers just fine at their traefik hosts. I am even able to ping the hosts from the command line of the containers themselves. However, inside the docker containers, I cannot reach the hosts using python requests or urllib3. It errors out with errno: 113, no route to host.

So for example, I can reach and browse to http://sentry.mydomain from any web browser, so I know that part of traefik and my containers are working.

I can ping sentry.mydomain from from the command line INSIDE any docker container. eg

# docker-compose run web bash
# ping sentry.mydomain
64 bytes from ... (success)

However, from python, INSIDE any docker container I cannot reach sentry.mydomain. even though I was just able to ping it. eg

# docker-compose run web bash
# ping sentry.mydomain
64 bytes from ... (success)
# python
>>> import requests
>>> r = requests.get('http://sentry.mydomain')
# stack trace ... Failed to establish a new connection: [Errno 113] No route to host'))

Examples from docker-compose.yml:

    <<: *defaults
      - "9000:9000"
      - 9000
      - web
      - internal
      - "traefik.enable=true"
      - "traefik.backend=sentry"
      - "traefik.http.routers.sentry.rule=Host(`sentry.mydomain`)"
      - "traefik.http.routers.sentry.entrypoints=web"
      - ""
      - "traefik.port=9000"
    image: "traefik:v2.0.0-rc3"
    container_name: "traefik"
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--accesslog"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "80:80"
      - "8080:8080"
      - web
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

Hi @j-gooding, can you try with latest traefik stable version first? you are using a release candidate, which is not really fresh :slight_smile: Try with latest stable, traefik:2.0.5.

Also, as it looks closely related to the docker network, could you provide a full reporoduction case? The compose file you provided is not complete (no network definition, the "parent" block default is not there, etc.) so we cannot really help you here.

Did you find a solution to this problem? I have the same problem right now.

It seems to be related to firewall/iptables issue but i didn't catch the solution yet.
Any advice ?

In my case, 2 container are connect to another traefik container.
From 1 container, i try to access to the other by the VIP traefik interface (the same IP, redirect by DNS).


any idea guys ?
Thanks by advance.

Up !
Appreciate by advance any clue.