2

So this is my docker-compose file

version: '3'

networks:
  traefik-net:
    driver: bridge

services:
  # The reverse proxy service (Træfik)
  reverse-proxy:
    image: traefik  # The official Traefik docker image
    ports:
      - "80:80"      # The HTTP port
      - "8082:8082"  # The Web UI (enabled by --api)
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/etc/traefik/traefik.toml
    labels:
      - "traefik.docker.network=traefik-net"
    networks:
     - traefik-net

  auth:
    image: auth
    labels:
      - "traefik.enable=true"
      - "traefik.backend=auth"
      - "traefik.frontend.rule=Host:auth.localhost"
      - "traefik.docker.network=traefik-net"
    networks:
     - traefik-net

  clients:
    image: clients
    labels:
      - "traefik.enable=true"
      - "traefik.backend=clients"
      - "traefik.frontend.rule=Host:clients.localhost"
      - "traefik.docker.network=traefik-net"
    networks:
     - traefik-net

and this is my traefik.toml file

defaultEntryPoints = ["http"]

[api]

[docker]
  endpoint = "unix:///var/run/docker.sock"
  domain = "traefik.localhost"
  watch = true

[entryPoints]
  [entryPoints.traefik]
  address = ":8082"

  [entryPoints.http]
  address = ":80"

What i am trying to do is to make a request from auth container to the clients container Inside the auth container i execute this commande

wget -qO- --header="Host: clients.localhost" http://localhost/

i get this output

wget: can't connect to remote host (127.0.0.1): Connection refused

outside the container the commande works just fine. what can i do to make requests from one container to the other using traefik

thanks for the help :)

LeMidi
  • 21
  • 3
  • Have you encountered the problem of ip conversion to intranet ip?? – cobenash Sep 25 '18 at 09:23
  • Take a look at [this](https://stackoverflow.com/a/53503399) for a solution using host's dns, or [this](https://stackoverflow.com/a/46453404) for a more docker-ish solution. The first is more dynamic, since it will work for any subdomain in the same domain without changes – Choma Jan 21 '19 at 20:14

0 Answers0