Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda