Alpine-based Nginx dynamically configured by Consul-Template
2.3K
An extenable docker image that runs Nginx with its configuration driven by Consul via Consul-Template.
This is meant to act as a base image, and therefore only manages settings for the main (global) and http contexts. Server/location contexts and deeper configuration should be managed in derived images.
Use NGINX_CONF_KEY to set the key prefix where the Nginx configuration will
be found in Consul. If not set, nginx will be used.
The NGINX_CONF_COMMON_KEY can be used in the same manner as NGINX_CONF_KEY
above. Settings found in the NGINX_CONF_COMMON_KEY will be rendered before
those found in NGINX_CONF_KEY, the idea being global/common settings can be
shared between multiple nginx instances, and overridden when necessary.
You must set CONSUL_HTTP_ADDR in order for consul-template to render
any templates when the container runs. Any supported consul-template environment
variables can be used, such as:
The following environment variables can be used to adjust consul-template:
err30s5sSee the consul-template documentation for details about these settings.
<NGINX_CONF_KEY>/main/* - any valid main context directives<NGINX_CONF_KEY>/http/* - any valid http context directives<NGINX_CONF_KEY>/http/log_format/* - log_format name/configuration<NGINX_CONF_KEY>/http/add_header/* - add headers in http blockAny file added to /etc/nginx/templates will be automatically registered
as a template for consul-template when the container runs.
Additional Nginx customizations can be made by adding .conf files to
/etc/nginx/conf.d. These files will not be rendered by consul-template.
For additional control over the configuration of consul-template, valid HCL
or JSON consul-template config(s) can be added to /etc/consul-template.d.
Content type
Image
Digest
Size
10.7 MB
Last updated
over 8 years ago
docker pull bdclark/nginx-consul