HAProxy community

Auto load-balancing HAProxy with docker

Hello everybody,

TL;DR: Is it possible to spin up a HAProxy instance and then without configuring it anymore, have other docker services automatically reverse-proxied and load-balanced?

I already used HAProxy in the past but it was for a simple project with only one web server to load-balance.

In the meantime I worked in some projects that has several services/servers that could be up or down depending on the situation. All of these services/servers being dockerized containers.
For this I was using Traefik since I had to only spin up Traefik once, and then I can add as many services as I want without touching or configuring Traefik.
All is done by defining some label options for the services and everything just works.

I wanted to know if HAProxy has also such integration with docker containers?

I found that blog post that gives an example https://medium.com/@nirgn/load-balancing-applications-with-haproxy-and-docker-d719b7c5b231
But there isn’t much details about more configuration (like setting the subdomain) and most importantly the image referenced in the article seems to be deprecated https://github.com/docker-archive/dockercloud-haproxy

Thanks for providing any details about that.
Have a nice day…