How to setup docker Traefik 2.3 with a service running on locahost

Hi, So the problem is that I am running prometheus node exporter metrics on a vps in the cloud listening on all interfaces on port 9100. Traefik 2.3 is setup using docker-compose and running inside a container. How do I setup the service in Traefik so that it is using the node exporter metrics on locahost. I cannot use, because this points to locahost inside the container and not localhost on the actual host. I also cannot bind to the ip on the primary network interface, because the vps is running behind a firewall and I do not want to expose the metrics to the public internet. My provider Digital Ocean also supplies a internal ip. Which works when using curl on the host to get the metrics, but does not work when using traefik to connect to that internal ip (when defined as a service -> just ends up in a timeout).

So yeah the question in short form is: How do I setup Traefik 2.3 running as a container with a service running on localhost on the host server?

Use the gateway ip for that docker network.

1 Like

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