Automatically proxies requests to docker containers
2.1K
This docker image automatic proxies requests to your docker containers
First, pull the image from docker hub
# use correct tag
docker pull stephenafamo/docker-nginx-auto-proxy:4.x.x
Run a container
docker run --name nginx -v /path/to/my/config/directory:/docker/config -p 80:80 -p 443:443 stephenafamo/docker-nginx-auto-proxy:4.x.x
The container reads any file with the extension .toml in /docker/config. You can change this folder using the CONFIG_DIR environmental variable.
To easily manage all proxies, you should mount your own configuration directory.
-v /path/to/my/config/dir:/docker/config
These are the environmental variables you can use to tweak the behaviour of this image.
EMAIL: The email used to accept the TOS for getting Let's Encrypt certificates. REQUIREDCONFIG_DIR: This is a set of directories where the container will look for .config files. Multiple directories are separated with a colon :. Default /docker/config.CONFIG_RELOAD_TIME: This image automatically checks for changes to your configuration files. This environmental variable is used to set how long it should wait between checks. Default is 5s. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Examples of durations are:
HTTPS_VALIDITY: How often the entire config should be purged and reconfigured even if there are no changes. This is useful for things like auto-renewing letsencrypt certificates. Default 168h(1 week).LETSENCRYPT_CREDS_DIR: The directory where credential files for certbot dns plugins will be placed. Default is /docker/letsencrypt-credentialsLETSENCRYPT_DNS_PROPAGATION: Seconds to wait for dns propagation when using the dns authentication method. Default is 120A configuration file is a set of defined services. You can put multiple services in a single file, and you can have multiple files in the CONFIG_DIR or any of its subdirectories. All configuration files must end with .toml. Services are defined using the toml format.
The parameters used to define a service are based on the type of proxy needed. HTTP or TCP/UDP.
Each service should be the TOML equivalient of the ServiceConfig type.
Location, LocationOptions, Upstream, and UpstreamOptions are an easy way to set only a single key in Locations (where Match == Location). Since many services will define only a single location, it's easier to do[unique-key]
domains = ["my.domain.com"]
upstream = [{address = "upstream.io"}]
ssl = true
sslSource = "letsencrypt"
httpsOnly = true
than:
[unique-key]
domains = ["my.domain.com"]
ssl = true
sslSource = "letsencrypt"
httpsOnly = true
[[unique-key.locations]]
upstream = [{address = "upstream.io"}]
match = "/"
Both ways are completely valid though.
See comments on the ServiceConfig. struct for details. Some examples will be added soon (PRs welcome).
If set up correctly, the container will attempt to get a new certificate if there was none, or renew the certificate.
Certificates that were last configured {HTTPS_VALIDITY} ago will automatically be retried.
Please inform me of any issues or feature requests, Pull requests are appreciated.
Content type
Image
Digest
sha256:b45828c30…
Size
136.3 MB
Last updated
almost 2 years ago
docker pull stephenafamo/docker-nginx-auto-proxy