Issues with multiple services with Traefik

I am new to Traefik. I am starting to move all my services behind Traefik but have run into what I think is some sort of a limit.

My Traefik config:

[entryPoints]
  [entryPoints.web]
    address = ":80"
    [entryPoints.web.http.redirections.entryPoint]
      to = "websecure"
      scheme = "https"

  [entryPoints.websecure]
    address = ":443"

[api]
  dashboard = true

[certificatesResolvers.lets-encrypt.acme]
  email = "email@email.com"
  storage = "acme.json"
  [certificatesResolvers.lets-encrypt.acme.dnsChallenge]
    provider = "duckdns"


[providers.docker]
  watch = true
  network = "web"

[providers.file]
  filename = "traefik_dynamic.toml"

Dynamic config:

[http.middlewares.simpleAuth.basicAuth]
  users = [
    "user:$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ]

[http.routers.api]
  rule = "Host(`subdomain.duckdns.org`)"
  entrypoints = ["websecure"]
  middlewares = ["simpleAuth"]
  service = "api@internal"
  [http.routers.api.tls]
    certResolver = "lets-encrypt"

The docker-compose:

version: '3.7'

services:
  adminer:
    image: adminer:latest
    container_name: adminer
    restart: unless-stopped
    networks:
      - local
      - traefik
    ports:
      - 3002:8080
    labels:
      - traefik.http.routers.adminer.rule=Host(`adminer.subdomain.duckdns.org`)
      - traefik.http.routers.adminer.tls=true
      - traefik.http.routers.adminer.tls.certresolver=lets-encrypt
      - traefik.port=3002
  portainer:
    container_name: portainer
    image: portainer/portainer-ce
    networks:
      - traefik
    restart: unless-stopped
    ports:
      - 8000:8000
      - 9000:9000
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock
      - /media/data/portainer:/data
    labels:
      - traefik.enable=false
      - traefik.http.routers.portainer.rule=Host(`portainer.subdomain.duckdns.org`)
      - traefik.http.routers.portainer.tls=true
      - traefik.http.routers.portainer.tls.certresolver=lets-encrypt
      - traefil.docker.network=traefik
      - traefik.port=9000
  traefik:
    image: traefik:v2.4.2
    container_name: traefik
    restart: unless-stopped
    networks:
      - traefik
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /media/data/traefik/traefik.toml:/traefik.toml
      - /media/data/traefik/traefik_dynamic.toml:/traefik_dynamic.toml
      - /media/data/traefik/acme.json:/acme.json
    environment:
      - TZ=America/Chicago
      - PUID=1000
      - PGID=1001
      - DUCKDNS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
networks:
  traefik:
    name: traefik
  local:
    name: local
  1. When I try to run both portainer and adminer, none of the webpages load.
  2. When I run just adminer, it works fine. But if I run portainer alone, it results in 404.

I have about 3 services (including the Traefik dashboard) working fine. I can't get anymore to work.

Any tips on what might be going on? Is there a limit on how many services can be run behind Traefik?

I've got ~25 with file and docker providers.

Your adminer has two networks and no docker.traefik.network label, that will definitely cause issues.

Both adminer and portainer have traefik.port labels which is not valid config.

Thanks that was it for adminer.

Thanks for this pointer. I changed it to: traefik.http.services.xxx.loadbalancer.server.port=9000 for portainer and removed it all other services.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.