/docker-nginx-balancer

[DEPRECATED] A simple load balancer with NGinx

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Simple NGinx Implementation for balancer (DEPRECATED)

Docker Pulls

This is a simple implementation of a balancer using NGinx and docker. See this repo for an example.

Hosts

Hosts are passed using the environment variable NODES with a space between their values. The values are passed as host:port.

Print

Implementing a load balancer

To illustrate this example, lets use the strm/helloworld-http for testing this image, create the following docker-compose.yml

version: '2'
services:
    front:
        image: strm/nginx-balancer
        container_name: load-balancer
        ports:
            - "80:8080"
        environment:
            - "NODES=web1:80 web2:80"
    web1:
        image: strm/helloworld-http
    web2:
        image: strm/helloworld-http

To run the image use the command:

docker-compose up

And you will see in the result that the balancer is working and balancing the request through images web1 and web2