A Docker image from haproxy:alpine with simple TCP/HTTP traffic routing, configurable via environment variables
The Docker official image for haproxy does not contain a configuration file. The documentation recommends building a new image containing your haproxy.cfg.
haproxy-env extends haproxy with a simple "patchcord" use case that proxies traffic from a frontend bind port to a backend server:port via tcp or http. It is configured via environment variables and no image build is required.
A typical scenario would be a multi-container application where haproxy-env would tunnel traffic from a frontend node, with publicly exposed IP addresses, to a service running on a backend node.
The following environment variables must be passed into
docker run or
- HAPROXY_MODE - [
- HAPROXY_BIND_PORT - port_number
- HAPROXY_BACKEND - address:port
- address is an ip address or resolvable host name
An example using haproxy-env to tunnel HTTP traffic to a nginx backend can be found on github at bobfraser1/nginx-app.