keepalived conf不会从docker run中读取环境变量

时间:2018-12-04 19:33:58

标签: docker load-balancing haproxy keep-alive

我为带有kealived(2.0.7-r1)的haproxy(1.18-alpine)创建了一个docker镜像。我需要知道如何将值传递给keepalived.conf?这是必需的,因为当我使用环境变量运行docker映像时,keepalived.conf可以访问这些值。

这在haproxy 1.18(debian)中以keepalived 1:1.3.2-1正常运行。但这在haproxy alpine中不起作用。错误为“(第2行)意外的'{'-忽略”

下面是keepalived.conf中的几行

vrrp_script chk_haproxy {
    script ${CHECK_SCRIPT:-/keepalived/chk_haproxy.sh}
    interval ${CHECK_INTERVAL:-7}     # check every X seconds
    fall ${CHECK_FALL:-1}             # require X failures for KO
    rise ${CHECK_RISE:-1}             # require X successes for OK
    timeout 20
}

下面是docker run命令,

docker run -d --name loadbalancer -e CHECK_INTERVAL=10 

Docker入口点执行一个shell脚本并开始keepalived,

/usr/sbin/keepalived --dont-fork --dump-conf --log-console --log-detail --log-facility 7 --vrrp -f /keepalived/keepalived.conf

是否由于高山图片或keepalived 2.0.7无法访问参数值而发生错误?

0 个答案:

没有答案