Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
docker-compose scale does not work with haproxy

I'm playing around with docker-compose haproxy and nginx. What I'm trying to accomplish is that if I scale the nginx container to be

docker-compose scale nginx=2

the haproxy container also proxies the new nginx container. But somehow its not recognizing the new container.

Here are my configs:

docker-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 

What could I do to get haproxy to recognize the new container without just adding one more nginx into docker-compose file manually?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

After doing some reasearch I found a solution to work with docker swarm. Docker swarm has its own load-balancer. But to reverse proxy to the services best fit seemed to be docker-flow-proxy from the legendary Victor Farcic https://github.com/vfarcic/docker-flow-proxy

One can then just add the new services to the proxy.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda