Public | Automated Build

Last pushed: 3 months ago
Short Description
Docker image for consul-template with template for nginx
Full Description

Docker Consul Template

Available Templates

nginx.ctmpl

Available Versions

  • 0.11 (docker tags: 0.11, 0.11-dockerinside-1.10, 0.11-dockerinside-1.11)
  • 0.12 (docker tags: 0.12, 0.12-dockerinside-1.10, 0.12-dockerinside-1.11)

The tag 0.11 works only on debian jessie or ubuntu trusty docker host.

Usage

You need to have a running nginx container.

Tag 0.11

docker run -d --name consul-template \
    --net=host --restart=always \
    --volumes-from=nginx \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v ${DOCKER_BINARY}:/usr/bin/docker \
    -v /usr/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/:ro \
    -v /lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu \
    -e DOMAIN=example.com \
    -e NGINX_SSL_CERT_PATH=/etc/nginx/ssl/cert.pem \
    -e NGINX_SSL_KEY_PATH=/etc/nginx/ssl/key.pem \
    alterway/consul-template-nginx:0.11 -consul=localhost:8500 -wait=2s -log-level=err -template="/etc/ctmpl/nginx.ctmpl:/etc/nginx/nginx.conf:docker kill -s HUP nginx"

Tags 0.11-dockerinside-1.10 and 0.11-dockerinside-1.11

docker run -d --name consul-template \
    --net=host --restart=always \
    --volumes-from=nginx \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e DOMAIN=example.com \
    -e NGINX_SSL_CERT_PATH=/etc/nginx/ssl/cert.pem \
    -e NGINX_SSL_KEY_PATH=/etc/nginx/ssl/key.pem \
    alterway/consul-template-nginx:0.11 -consul=localhost:8500 -wait=2s -log-level=err -template="/etc/ctmpl/nginx.ctmpl:/etc/nginx/nginx.conf:docker kill -s HUP nginx"

Docker-compose example


version: "2"

services:
  consul:
    container_name: consul
    command: -server -bootstrap-expect 1 -domain example.com -advertise <IP NODE> -dc datacenter1 -recursor 8.8.8.8 -ui-dir /ui -data-dir /data/consul -encrypt <SECRET_KEY_BASE>
    network_mode: host
    image: progrium/consul:latest
    restart: always

  nginx:
    container_name: nginx
    image: nginx:1.8.1-alpine
    network_mode: host
    restart: always
    volumes:
      - /etc/nginx/
      - /nginx-ssl:/etc/nginx/ssl

  consul-template:
    container_name: consul-template
    command: -consul=localhost:8500 -wait=5s -template="/etc/ctmpl/nginx.ctmpl:/etc/nginx/nginx.conf:docker kill -s HUP nginx"
    image: alterway/consul-template-nginx:0.12-dockerinside-1.10
    network_mode: host
    restart: always
    volumes_from:
      - nginx
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      DOMAIN: 'example.com'
      NGINX_SSL_CERT_PATH: '/etc/nginx/ssl/cert.pem'
      NGINX_SSL_KEY_PATH: '/etc/nginx/ssl/key.pem'

  registrator:
    container_name: 'registrator'
    image: gliderlabs/registrator
    command: -ip <IP_NODE> consul://localhost:8500
    network_mode: host
    restart: always
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock

Environment Variables

  • DOMAIN : To set the domain for services (required)
  • NGINX_SSL_CERT_PATH : To set the path to cert if ssl configuration. (optionnal)
  • NGINX_SSL_KEY_PATH : To set the path to key if ssl configuration. (optionnal)
  • REQUEST_AUTH : Set to "1" if you want use auth_request nginx module. (optionnal)
  • REQUEST_AUTH_URL : URL to service for auth_request. (optionnal, required if REQUEST_AUTH)
  • REQUEST_AUTH_HOST : The host who have the auth service to set proxy header. (optionnal, required if REQUEST_AUTH)
  • REQUEST_AUTH_LOGIN_PAGE : The URL for login page if REQUEST_AUTH receive 401 http code. (optionnal)

Contributors

License

View LICENSE for the software contained in this image.

Docker Pull Command
Owner
alterway
Source Repository

Comments (0)