6

My haproxy.cfg file has one backend servers using hostnames:

backend servers
    server myapp ${PORTAL_PORT_3000_TCP_ADDR}:${PORTAL_PORT_3000_TCP_PORT} maxconn 32

myapp is running in other docker container linked to haproxy docker container. The mentioned environment variable have values inside haproxy container but when it container start raise this error

[ALERT] 244/134924 (8) : parsing [/etc/haproxy.cfg:16] : Unknown host in '${PORTAL_PORT_3000_TCP_ADDR}:${PORTAL_PORT_3000_TCP_PORT}'
[ALERT] 244/134924 (8) : Error(s) found in configuration file : /etc/haproxy.cfg
[ALERT] 244/134934 (8) : Fatal errors found in configuration.
Montells
  • 165
  • 2
  • 7
  • helpful: https://serverfault.com/questions/668025/how-to-use-environment-variable-in-haproxy – ptim May 16 '17 at 00:56

1 Answers1

8

You are, most likely, using version 1.4 or older. The possibility to use environment variables has been introduced in haproxy 1.5.

Florin Asăvoaie
  • 7,057
  • 23
  • 35