我在碼頭構成haproxy和nginx玩耍。 我試圖做到的是,如果我縮放nginx的容器是碼頭構成規模不與haproxy一起工作
泊塢窗,撰寫規模的nginx = 2
的HAProxy的容器還代理了新的nginx的容器。但不知何故它不承認新的集裝箱。
這裏是我的CONFIGS:
泊塢窗,compose.yml:
version: '2.1'
services:
nginx:
image: 'bitnami/nginx:latest'
healthcheck:
test: "curl -f http://localhost/?healthcheck"
expose:
- "80"
haproxy:
image: haproxy
restart: always
depends_on:
nginx:
condition: service_healthy
links:
- nginx
ports:
- "80:80"
volumes:
- ./haproxy:/usr/local/etc/haproxy/
expose:
- "80"
haproxy.cfg
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
defaults
log global
mode http
option httplog
timeout connect 5000
timeout client 10000
timeout server 10000
frontend localnodes
bind 0.0.0.0:80
mode http
default_backend nodes
backend nodes
mode http
option forwardfor
balance roundrobin
server nginx nginx:80 check
option httpchk GET /?haproxyselfcheck
http-check expect status 200
我應該怎麼做才能HAProxy的識別新的容器,而不只是手動添加一個更多的nginx到docker-compose文件中?