Open zasdaym opened 9 months ago
Would you mind sharing the command you are using to spin up the containers?
docker run --name haproxy --detach --network host -v /var/run/docker.sock:/var/run/docker.sock:ro -e EASYHAPROXY_DISCOVER=docker byjg/easy-haproxy:4.4.0
docker run --name grafana --detach --network host --label easyhaproxy.grafana.host=grafana.zasdaym.my.id --label easyhaproxy.localport=3000 grafana/grafana-oss:10.2.3
Hello, the Easy HAProxy will not work with the network host.
Try change to:
docker run --name haproxy --detach -p 80:80 -p 443:443 -p 1936:1936 -v /var/run/docker.sock:/var/run/docker.sock:ro -e EASYHAPROXY_DISCOVER=docker byjg/easy-haproxy:4.4.0
docker run --name grafana --detach --label easyhaproxy.grafana.host=grafana.zasdaym.my.id --label easyhaproxy.localport=3000 grafana/grafana-oss:10.2.3
You do not need map the port for the Grafana container since the access will be done by the EASYPROXY on the address http://grafana.zasdaym.my.id
May I know why it doesn't work on host network? I think it's good to mention it in the documentation too.
EasyHAProxy requires network inspection from within the Docker container where it's deployed. When a container resides in a different network, it must be added to the EasyHAProxy network (source: https://github.com/byjg/docker-easy-haproxy/blob/master/src/processor/__init__.py#L116-L143).
In this specific scenario, the container fails to detect other containers due to its inability to recognize the host network. This is the primary technical limitation.
Additionally, deploying EasyHAProxy in front of containers eliminates the need for exposing them individually, as all traffic can now be efficiently redirected through HAProxy.
Hi, I'm trying to use the standalone docker discovery but can't make it work.