docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

Confused about running the proxy on non-manager nodes #215

Open samattridge opened 6 years ago

samattridge commented 6 years ago

Sorry if I've missed something obvious but I'm a bit confused with the approach of running the proxy on non-manager nodes while in Swarm Mode. The documentation says the following:

For dockercloud/haproxy service: If you mount /var/run/docker.sock, it can only be run on swarm manager nodes. If you want the haproxy service to run on worker nodes, you need to setup DOCKER_HOST envvar that points to the manager address.

So I set the DOCKER_HOST envvar on the haproxy service I created to point to a manager node but get the following error:

Haproxy is running using legacy link, loading HAProxy definition from environment variables: unable to get dockercloud/haproxy container inspect information, 404 Client Error: Not Found ("{"message":"No such container: 8ee8f211b858"}")

Looking at the source code, it seems that it attempts to determine which mode it is running it automatically by inspecting the docker configuration by the id of the container. So when I set the DOCKER_HOST envvar to a management node which isn't running the container, unsurprisingly, it is unable to find the container by its id and falls back to legacy mode.

Any ideas?

Many thanks in advance.