Public | Automated Build

Last pushed: 2 years ago
Short Description
Application Load Balancer container for the The Lightweight Docker Runtime.
Full Description

Application Load Balancer (ALB)


  • Docker Toolbox 1.9
  • A running Docker engine provisioned via Docker Machine (assumed to be "alb" in the rest of this documentation):
docker-machine create -d virtualbox alb

Building the container

docker build -t tldr_alb .

How it works


Running the container

Use the TLDR_LB_SERVICE_NAME environment variable, which identifies the names of the services that this load balancer should work with.

Variable SERVICE_TAGS should contain tldr.type:lb to identify this component as a load balancer, and to identify the app to which this load balancer belongs.

Also, provide the URL to the Consul server with the service information as a parameter:

docker run --name=web_lb -e SERVICE_TAGS=web -e SERVICE_NAME=web_lb --dns -p 80:80 -p 1936:1936 --rm alb -consul=$(docker-machine ip alb):8500

When ready, visit http://$(docker-machine ip alb):1936 (someuser/password) to verify that both nginx containers are visible to haproxy. To access nginx, use http://$(docker-machine ip alb)/web-80 (the 'web-80') part is a known issue.

Test run

To load balance a service called service1_testapp-80, use the following command:

docker run --name=service1_testapp_lb -e TLDR_LB_SERVICE_NAME=service1_testapp-80  -e SERVICE_TAGS=tldr.type:lb, -e SERVICE_NAME=service1_testapp_lb --dns -p 80:80 -p 1936:1936 --rm pass_alb -consul=$(docker-machine ip alb):8500 -dry -once

Alternatively, use the scripts under the test folder:

  1. Run tests/ to bootstrap a docker-machine host with the needed components (Consul and registrator)
  2. Run tests/ 1 to start two instances for the given service id/number
  3. Run tests/ 1 to start a load balancer for the given servie id/number. Must match with the parameter provided to

Known issues

Docker Pull Command
Source Repository