Traefik Load Balancer in Docker

I have the below yaml which spins up hotrod, jaeger and traefik. I am trying to load balance the hotrod containers. But when I try to access localhost:8100, I am not getting hotrod app. Any insights please?

version: '3.8'
services:
  jaeger:
    image: jaegertracing/all-in-one:latest
    ports:
      - "6831:6831/udp"
      - "16686:16686"
    networks:
      - jaeger-example

  hotrod:
    image: jaegertracing/example-hotrod:latest
    ports: 
      - "3000-4000:8080"
    command: ["all"]
    environment:
      - JAEGER_AGENT_HOST=jaeger
      - JAEGER_AGENT_PORT=6831
    networks:
      - jaeger-example
    depends_on:
      - jaeger
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=PathPrefixStrip:/"
      - "traefik.port=8100"
      - "traefik.http.routers.traefik.rule=Host(`hotrod-hotrod`)"


  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.4
    # Enables the web UI and tells Traefik to listen to docker
    command: --api.insecure=true --providers.docker --log.level=DEBUG
    ports:
      # The HTTP port
      - "8081:80"
      # The Web UI (enabled by --api.insecure=true)
      - "8090:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock

networks:
  jaeger-example:

Hi @QAInsights

As traefix is only exposing 8081 and 8090 with no additional configuration your hotrod would only be available via: http://hotrod-hotrod:8081

Further configuration may be required for hotrod if that still does not work.

1 Like

Thanks @cakiwi hotrod-hotrod:8081 is not working. Any insights on the configuration please?

Hi @QAInsights

I would need a better problem description than 'not working'

Many softwares may need specific configurations, headers etc when access via a reverse proxy.

With my 2 minutes of looking at the documentation I can see the hotrod uses port 8080 by default, the container label of traefik.port=8100 is not compatible with that.

This is not a valid option for traefik v2

The traefik container and the hotrod container do not have a common network, traefik would not be able to route to the container. Make sure they have a common network and use Traefik Docker Documentation - Traefik or the container label equivalent per the link.