docker-lb
A dynamic front-end Load Balancer simple docker environments
Docker-LB is a Layer-7 load-balancer and web front-end for simple docker environments. It can be used for exposing microservices under different virtual servers and paths.
Usage
Deploy Docker-LB to your public-facing node(s):
docker run -d --name docker-lb \
-p 80:80 -p 443:443 \
-e AUTOCERT_EMAIL=admin@mydomain.com \
-e AUTOCERT_ORGANISATION="My Company" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run/docker-lb:/var/run/docker-lb \
wavesoft/docker-lb:latest
Then you can expose one or more services attached on the same docker network as the docker-lb
service by specifying the following labels:
docker run \
-l publish.domain=mydomain.com \
-l publish.port=8080 \
-l publish.ssl=on \
...
Labels
The following labels can be used on the service containers:
Label |
Default |
Description |
publish.domain |
Required |
The VirtualServer under which to make this container available under. (Eg mydomain.com ) |
publish.port |
80 |
Which container port to use as the back-end server. This does not have to be published via -p , since docker-lb will reach it through the container network. |
publish.path |
/ |
The HTTP path to match and forward to the back-end. This is a shorthand to set both publish.path.frontend and publish.path.backend to the same value. |
publish.path.frontend |
/ |
The HTTP path to match on the Virtual Server. You can use this option to implement path-based routing. |
publish.path.backend |
/ |
The HTTP path to match redirect to the back-end server to. If this is different than the publish.path.frontend , an HTTP rewrite rule will be established. |
publish.ssl |
off |
Set to on to expose this service under HTTPS. A certificate will be automatically issued for this service using Lets-Encrypt. |