A Docker container that distributes HTTP and HTTPS requests to other containers on the same system.
Configuration and Usage
docker-web-proxy uses the metadata from Docker to configure nginx proxies. To do this, it reads env vars off of other containers within your Docker instance. Currently, it's hard-coded to only use a Unix socket that must be exposed with
docker-web-proxy with the following:
docker run -p 80:80 -p 443:443 -v /var/run/docker.sock:/var/run/docker.sock -v /storage/ssl:/srv/ssl --rm eropple/docker-web-proxy
It'll immediately begin scanning for containers and update its internal configuration.
docker-web-proxy is configured through the setting of environment variables. Currently it understands only one environment variable:
PROXY_REFRESH_TIMEdefines, in seconds, how rapidly Docker should be polled for configuration changes. The default is
5, but depending on your use cases, dropping this to
1may make sense.
SSL certificates should be volumed to
/srv/ssl. Their naming convention is given under Endpoint Configuration, below.
Endpoints should likewise be configured with environment variables as below:
VHOSTdefines the hostname that should route to the decorated container.
PORTdefines the port on the container to route to. (Defaults to 80.)
HTTPSmay both be set to 1 or 0 and are used to turn SSL on or off. If both are set to 1, HTTP requests will be forwarded to HTTPS. (This behavior currently cannot be changed.)
HTTPS_KEY_NAMEdefines a custom key name that will be found within the directory volumed to
/srv/ssl. This defaults to the hostname if not set (for example, to use a wildcard certificate without having many copies in the directory). nginx will look for
/srv/ssl/$HTTPS_KEY_NAME.key, as appropriate.
docker-web-proxy is released under the Apache License, version 2.0.