Set traefik to point to internal IP address of docker services through DNS host overrides

Hi
I run some docker services like plex and currently access them internally with IPADDRESS:port but want to set up custom domains. I read online that you can setup host overrides (in my case with OPNsense) to point a customised domain (e.g hostname.doesntexist.com) to the reverse proxy address and then have the reverse proxy point to the container IP depending on the hostname. Two questions

  1. OPNsense firewall only allows host overrides without port numbers so i can't point things to traefik since traefik itself runs in a container so needs a port number, any way to get around this?
  2. How do i set up traefik to point to the internal IPs locally?
    Thanks, fairly new to traefik so sorry if the question is silly or basic

What do you want to achieve?

You can set up domains on every node in hosts file, at home you can usually setup local domains in the home router DNS.

You can also use a public DNS with (sub-)domain and point it to a private IP, that works without a problem.

I can setup host overrides in my home router DNS (OPNsense unbound) but can't include port numbers so not sure how i can direct custom DNS entries (e.g. plex.home.lan) to traefik container. Also if i manage to do this, my plan is to create aliases for my different containers with different subdomains (plex.home.lan, qbittorrent.home.lan, etc) in the host overrides and then arrange traefik to point to the appropriate containers but not sure how to set this up in the traefik config either

DNS resolves IPs, has nothing to do with ports. The port is given by the connection used, like http (80) or https (443) default ports.

If you want to run multiple services at home, externally reachable, you would usually forward ports 80+443 for http/s from the router to Traefik. Traefik can then determine by (sub-)domain which target services it further forwards the requests to.

When using Docker (Swarm for multiple nodes), you just add labels with the domain to your service and Traefik will automatically discover and just work.

See simple Traefik example.