automated reverse proxy based on haproxy and letsencrypt
363
simple automated reverse proxy for docker environments based on haproxy and LetsEncrypt!
latesttestingdocker run -d \
-v cert-data:/etc/letsencrypt \
-v /var/run/docker.sock:/var/run/docker.sock \
-p "80:80" -p "443:443" \
--name haproxy \
pheelee/haproxy
create a container and add a label named RP_VIRTUAL_HOST specifing the domain name and exposed container port to it.
Examples:
RP_VIRTUAL_HOST=foo.example.com:8080
RP_VIRTUAL_HOST=www.example.com, foo.example.com:8080
this generates a certificate (or adds the subdomain to an existing as SAN) for the domain foo.example.com and creates a reverse proxy entry for the container that owns the label. The port has to match the exposed port of the containers web application.
All HTTP requests are redirected to HTTPS!
If a new container with the label RP_VIRTUAL_HOST is created the following steps are automatically performed:
This container can generate a simple portal (frontend) for all its proxied applications (using PORTAL labels). To enable this feature you have to set the environment variable PORTAL_URL to a domain e.g portal.example.org
additionally you can customize the portal through the following variables
PORTAL_TITLE : the heading title of the portal (default "The Portal")To have a container appear in portal set the following labels on it:
PORTAL_NAME : Name of the Container e.g "Portainer"PORTAL_DESC : small Description of the Container e.g "Docker Management Web Interface"PORTAL_ICON : Icon (if omitted the favicon from the app is used)You can specify a randomly selected background by providing images in a volume binded folder
Example:
docker run -d \
-v cert-data:/etc/letsencrypt \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/haproxy/background:/portal/assets/img \
-p "80:80" -p "443:443" \
--name haproxy \
pheelee/haproxy
Content type
Image
Digest
Size
33.1 MB
Last updated
almost 9 years ago
docker pull pheelee/haproxy