项目作者: globalgiving

项目描述 :
Varnish Docker image with official vmods
高级语言:
项目地址: git://github.com/globalgiving/docker-varnish-modules.git
创建时间: 2016-12-15T17:46:59Z
项目社区:https://github.com/globalgiving/docker-varnish-modules

开源协议:

下载


Supported tags and respective Dockerfile links

Varnish Docker image with official vmods

Debian 8 - Jessie
Varnish 4.1.3
varnishncsa logging to stdout
varnish-modules 0.9.1 by Varnish Software
Extends globalgiving/varnish

Usage

To use this container, you will need to provide your custom config.vcl (which is usually the case).

  1. docker run -d \
  2. --link web-app:backend-host \
  3. --volumes-from web-app \
  4. --env 'VCL_CONFIG=/data/path/to/varnish.vcl' \
  5. --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123 \
  6. globalgiving/varnish

In the above example we assume that:

  • You have your application running inside web-app container and web server there is running on port 80 (although you don’t need to expose that port, as we use —link and varnish will connect directly to it)
  • web-app container has /data volume with varnish.vcl somewhere there
  • web-app is aliased inside varnish container as backend-host
  • 192.168.0.42 is running a daemon on port 123 which can consume syslog data.
  • Your varnish.vcl should contain at least backend definition like this:
    1. backend default {
    2. .host = "backend-host";
    3. .port = "80";
    4. }

Environmental variables

You can configure Varnish daemon by following env variables:

VCL_CONFIG /etc/varnish/default.vcl
CACHE_SIZE 64m
VARNISHD_PARAMS -p default_ttl=3600 -p default_grace=3600

Logging Output

The output of varnishncsa is piped to the standard out of the container, allowing the docker daemon to read it and direct that data to anywhere you wish.

The format (variable definitions) passed to varnishncsa:

  1. [%{x-forwarded-for}i] %u %t "%r" %s %b %T "%{Referer}i" "%{User-agent}i" %{Varnish:handling}x