Using local domain in loadBalancer url

I have 2 different hosts:
A: Raspberry Pi 4. This is where Traefik, Pi-hole, etc, where all the ingress networking to my setup comes in from.
B: Desktop. This is running services like Jellyfin, Navidrome, etc. This host is not reverse proxied. The services ports are exposed directly in Docker.

I tried Docker swarm networking to get Traefik to work across hosts and couldn't figure it out so I'm resorting to using http routers to access them. They look something like this:

http:
  routers:
    jellyfin-http:
      entryPoints:
        - "http"
      rule: "Host(`jellyfin.domain.com`)"
      service: "jellyfin"
      middlewares: "http-to-https"
    jellyfin-https:
      entryPoints:
        - "https"
      rule: "Host(`jellyfin.domain.com`)"
      service: "jellyfin"
      tls:
        certresolver: "http-cha"
  services:
      jellyfin:
        loadBalancer:
          servers:
            - url: "http://192.168.1.177:50096"
  middlewares:
    http-to-https:
      redirectscheme:
        scheme: "https"

This works well enough and saved me a lot of headaches when dealing with Docker swarm however I would like to use the local domain silver.lan instead of the IP address. I already have host A set up to use Pi-hole local DNS and resolve silver.lan to 192.168.1.177. This works fine everywhere except when used in Traefik like below:

...
services:
    jellyfin:
      loadBalancer:
        servers:
          - url: "http://silver.lan:50096"
...

Attaching to the container and pinging silver.lan from inside also does not work. I believe I had something similar work when I used Nginx Proxy Manager but I can't remember entirely.
Am I missing something?

I found 2 solutions.
1: Add a Docker-compose extra_hosts: entry. It works but isn't ideal.

2: Put Traefik a same user-created network as Pi-hole (which has a static IP) and, in Docker-compose for Traefik, add a dns: entry which points to the Pi-hole container static IP on the shared network. This is a much better solution. Example below:

services:
  traefik:
    image: docker.io/traefik:v2.10
    container_name: traefik
    restart: always
    ports:
      - 80:80/tcp
      - 443:443/tcp
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/docker/Containers/Networking/Traefik/traefik.yaml:/traefik.yaml:ro
      - /home/docker/Containers/Networking/Traefik/configs/:/configs/:ro
      - /home/docker/Containers/Networking/Traefik/acme.json:/acme.json:rw
      - /home/docker/Containers/Networking/Traefik/logs/:/logs/:rw
    read_only: true
    security_opt:
      - no-new-privileges=true
    networks:
      traefik-net:
      pihole-net:
    dns:
      - 192.168.0.2
    labels:
      traefik.enable: true
      traefik.http.routers.traefik-http.service: 'api@internal'
      traefik.http.routers.traefik-http.rule: 'Host(`xxxxx.xxxxx.xxxxx`)'
      traefik.http.routers.traefik-http.entrypoints: 'http'
      traefik.http.routers.traefik-http.middlewares: 'http-to-https'
      traefik.http.routers.traefik-https.service: 'api@internal'
      traefik.http.routers.traefik-https.rule: 'Host(`xxxxx.xxxxx.xxxxx`)'
      traefik.http.routers.traefik-https.entrypoints: 'https'
      traefik.http.routers.traefik-https.tls: true
      traefik.http.routers.traefik-https.tls.certresolver: 'http-cha'
      traefik.http.routers.traefik-https.middlewares: 'traefik-auth'
      traefik.http.middlewares.http-to-https.redirectscheme.scheme: 'https'
      traefik.http.middlewares.traefik-auth.basicauth.users: 'xxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

  pihole:
    image: docker.io/pihole/pihole:latest
    container_name: pihole
    restart: always
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 40180:80/tcp
    volumes:
      - /home/docker/Containers/Networking/PiHole/dns_config/:/etc/dnsmasq.d/
      - /home/docker/Containers/Networking/PiHole/pihole/:/etc/pihole/
    environment:
      TZ: 'America/New_York'
      WEBPASSWORD: 'xxxxxxxxxxxxxxxx'
      FTLCONF_REPLY_ADDR4: '192.168.1.178'
      PIHOLE_DNS_1: '127.0.0.1#40153' # I use Unbound
    networks:
      pihole-net:
        ipv4_address: 192.168.0.2
    cap_add:
      - NET_ADMIN
      - SYS_NICE

networks:
  traefik-net:
    name: traefik-net
    driver: bridge

  pihole-net:
    name: pihole-net
    ipam:
      driver: default
      config:
        - subnet: 192.168.0.0/24
          gateway: 192.168.0.1

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