我是docker和haproxy的新手..我尝试遵循官方docker hub repo中的示例.
所以,我有Dockerfile
FROM haproxy:1.5
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
和简单的haproxy配置(我希望将本地调用重定向到我的EB实例)
global
# daemon
maxconn 256
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
default_backend servers
backend servers
server server1 {my-app}.elasticbeanstalk.com:80 maxconn 32
构建并运行
$docker build .
$docker run --rm d4598bcc293f
容器启动并卡住,Ctrl C不会停止容器. “ docker kill”仅帮助.
我的EB资源已启动并正在运行
$curl {my-app}.elasticbeanstalk.com/status
{
"status": "OK"
}
但是本地通话失败
$boot2docker ip
192.168.59.104
$curl 192.168.59.104/status
curl: (7) Failed to connect to 192.168.59.104 port 80: Connection refused
我想念什么或做错什么?
谢谢!
UPDATE: I’ve found the problem with calls redirections. Wrong port
number in haproxy.cfg.But this problem still annoys me… Container starts and stucks,
Ctrl+C doen’t stop it. “docker kill” helps only.
最佳答案