Docker Community Forums

Share and learn in the Docker community.

Docker compose dynamic load-balancer


(Techyugadi) #1

Most orchestration scenarios using dockers need dynamic load-balancing. Support for a built-in dynamic load-balance option in the docker-compose.yml file would be awesome !
For example, in the .yml below a support for a “loadbalance” option with load-balancing policy could be:
web:
build: .
links:

  • db
    ports:
  • "8000:8000"
    loadbalance:
  • "round-robin"
    db:
    image: postgres
    Now, if docker-compose is run using the following commands:
    docker-compose up
    docker-compose scale web=10
    the load-balancer should send the requests to the webapp instances in round-robin fashion.
    (May be the load-balancer could be pluggable)

(devmtl) #2

I don’t see the use case for compose.

I use this proxy repo https://github.com/jwilder/nginx-proxy/ It’s awesome and also does lb out of the box :slight_smile: