Traefik external Services

In this article we are featuring a guide how to connect external services (on other hosts) with Traefik hosted on Docker. This can be a raspberry pi running pi-hole, a synology NAS with DSM or another Docker host.

Traefik external Services
Photo by Alex Cheung / Unsplash

If you're a fellow self-hoster like me, you've probably had multiple iterations of your homelab which ranged from rag-tag hardware to investing further into professional or consumer grade hardware. You follow guides online and set up stuff like traefik (v2) as a reverse proxy, portainer and maybe even that spare raspberry pi you had laying around gets used to run an instance of pi-hole.

This guide is directed at people like you who set up Traefik, not knowing what brick wall worth of documentation would hit you when you were trying to figure out how you can connect further network devices and hosts up to your funky little reverse proxy.

I'll cut it short, you'll of course want to have a running traefik instance, in my case I am using the .toml file format for my dynamic file configuration.

So most ideally you'd also create a traefik-provider.toml and mount it inside your docker-compose.ymlas a volume.

Here's an example file:

# traefik-provider.toml
    [<service name>.loadBalancer]
      passHostHeader = true
      [[<service name.loadBalancer.servers]]
        url = "http://<ip>:<port>"

    [http.routers.<router name>]
      entryPoints = ["<your https entrypoint>"]
      rule = "Host(``)"
      service = "<service name>"
      [http.routers.<router name>.tls]
      certResolver = "<certificate resolver name>"

# Everything below you can leave unchanged.

    sniStrict = true
    minVersion = "VersionTLS12"
    curvePreferences = [
    cipherSuites = [
      minVersion = "VersionTLS13"

Thing to replace for you are the <service name>, <ip>:<port> combo, the <router name>, <your https entrypoint>, the host rule - so adapt it to your hostname, and your <certificate resolver name>. After that you can restart traefik and check the dashboard if the file is accepted as a provider successfully.

If that's the case, then all you need to do now is make sure that the application / service on the other host is listening on the specified port. Then you should hopefully be able to access your NAS or pi-hole or other docker host without issue.