Docker – haproxy displaying incorrect version / 503 service unavailable

containersdockerhaproxy

I am using docker with a few containers. One of my containers has haproxy and I wish to reverse proxy a domain to one of the other containers which is holding a web server.

There are a few weird things happening. First is the version of haproxy and the status page.

haproxy --version
HA-Proxy version 1.5.12 2015/05/02
Copyright 2000-2015 Willy Tarreau <w@1wt.eu>

When I go into mydomain.com one of these two pop up randomly:

enter image description here

Or:

enter image description here

The bottom image has more info but it still stating the wrong version?

Here is my /etc/haproxy/haproxy.cfg file:

global
    log 127.0.0.1   local0
    log 127.0.0.1   local1 notice
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

defaults
    log global
    mode    http
    option  httplog
    option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000

frontend http-in
        bind *:80

        # Define hosts
        acl host_mydomain hdr(host) -i mydomain.com

        ## figure out which one to use
        use_backend mydomain_cluster if host_mydomain

backend mydomain_cluster
        balance leastconn
        option httpclose
        option forwardfor
        cookie JSESSIONID prefix
        server node1 172.17.0.42:8080 cookie A check

The 172.17.0.42 is the ip address of the web server container with it's port 8080.

Best Answer

I had first installed 14.x then wanted to upgrade to 15.x. Not friendly to upgrading. I actually scrapped the entire container/image and started from a fresh ubuntu:trusty image.

Also the reason behind it showing both windows sometimes was that both stats and my webserver was binded to port 80, just changed the port binding on stats to something else then that fixed it!

listen stats
    bind       :1988
    stats uri /