Skip to main content

Container Labels

Container (Docker or Swarm) labels

easyhaproxy.[definition].hostHost(s) HAProxy is listening. More than one host use comma as OR,
easyhaproxy.[definition].mode(Optional) Is this http or tcp mode in HAProxy.httphttp or tcp
easyhaproxy.[definition].port(Optional) Port HAProxy will listen for the host.803000
easyhaproxy.[definition].localport(Optional) Port container is listening.808080
easyhaproxy.[definition].redirect(Optional) JSON containing key/value pair from host/to URL redirect.empty{"":"", "":""}
easyhaproxy.[definition].sslcert(Optional) Cert PEM Base64 encoded. Do not use this if certbot is enabled.emptybase64 cert + key
easyhaproxy.[definition].ssl(Optional) If true you need to provide certificate as a file. See below. Do not use with sslcert.falsetrue or false
easyhaproxy.[definition].ssl-check(Optional) ssl, enable health check via SSL in mode tcpemptyssl
easyhaproxy.[definition].certbot(Optional) Generate certificate with certbot. Do not use with sslcert parameter. More info here.falsetrue OR false
easyhaproxy.[definition].redirect_ssl(Optional) Redirect all requests to httpsfalsetrue OR false
easyhaproxy.[definition].clone_to_ssl(Optional) It copies the configuration to HTTPS(443) and disable SSL from the current config. *Do not use this with ssl or certbot parametersfalsetrue OR false
easyhaproxy.[definition].balance(Optional) HAProxy balance algorithm. See HAProxy documentationroundrobinroundrobin, source, uri, url_param, hdr, rdp-cookie, leastconn, first, static-rr, rdp-cookie, hdr_dom, map-based

The definition is a string that will group all configurations togethers. Different definition will create different configurations.

The container can have more than one definition.


Single Definition

docker run \
--label easyhaproxy.webapi.port=80\
--label \

Multiples Definitions on the same container

docker run \
--label \
--label \
--label \

--label easyhaproxy.admin.port=80 \
--label easyhaproxy.admin.localport=3001 \
--label \
.... \

Multiples hosts on the same container

docker run \
--label \
--label \
--label, \
.... \

If you are using docker-compose you can use this way:

version: "3"

image: some/myimage
labels: 80 3000 >-,

TCP Mode

Set easyhaproxy.[definition].mode=tcp if your application uses TCP protocol instead of HTTP.

docker run \
--label easyhaproxy.example.mode=tcp \
--label easyhaproxy.example.port=3306
--label easyhaproxy.example.localport=3306
.... \

Redirect Domains

docker run \
--label easyhaproxy.[definition].redirect='{"":"","":""}'

Open source ByJG