Closed ZiyamSanthosh closed 2 years ago
localhost
in your container is itself, not host which is running docker and haproxy.
Citing from https://stackoverflow.com/a/62431165/3835210:
For linux systems, you can – starting from major version
20.04
of the docker engine – now also communicate with the host viahost.docker.internal
. This won't work automatically, but you need to provide the following run flag:--add-host=host.docker.internal:host-gateway
Citing from https://stackoverflow.com/a/62431165/3835210:
For linux systems, you can – starting from major version
20.04
of the docker engine – now also communicate with the host viahost.docker.internal
. This won't work automatically, but you need to provide the following run flag:--add-host=host.docker.internal:host-gateway
Thank you @aminvakil
I have configured HAProxy locally in my machine and I have tried to read the metrics of it using haproxy_exporter. I am using the docker image of the haproxy_exporter and used the below-given command to execute it.
docker run -p 9101:9101 prom/haproxy-exporter:latest --haproxy.scrape-uri="http://localhost:8181/stats;csv"
If I try to reach the metric endpoint, I am getting this error saying that the connection is refused. What am I doing wrong?
Below given is the configuration I used for HAProxy