This Docker container can be used to launch Varnishd with the Varnischncsa logger. The varnishncsa utility reads varnishd's shared memory logs and presents them in the Apache/NCSA "combined" log format.
This format can be customized in the supervisord.conf to match your preferred format so it's log volume can be mounted to other Docker containers for analysis/graphing.
This image is available for download on the Docker Index.
docker pull paul91/varnish
If successful, this image can be found in your local list of images through docker ps
.
If you would like to customize this container, clone this repo, make your changes, and build.
docker build -t paul91/varnish .
It is recommended that you either mount the container's /var/log/varnish
directory to the host machine or another container (i.e LogStash) to fully take advantage of the NCSA logging.
docker run -i -t -p 80:80 -v /tmp/varnish:/var/log/varnish paul91/varnish
You can also mount a custom default.vcl
using Docker volumes.
docker run -d -p 80:80 \
-v $(pwd)/custom.vcl:/etc/varnish/default.vcl:ro \
-v /tmp/varnish/:/var/log/varnish \
paul91/varnish
Setting any of the following environment variables with -e
will override the defaults set in the Dockerfile
when Varnish is started. If you would like to add additional parameters, please open a Pull Request.
VARNISH_TTL
: Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter. Default: 60
VARNISHNCSA_LOGFORMAT
: Specify the log format used. If no format is specified the default log format is used. Default:%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"
All running paul91/varnish
containers can be killed by the following command.
docker ps | grep 'paul91/varnish' | awk '{print $1}' | xargs docker kill
The Vagrantfile
packaged with this Docker container will build a virtual machine using CoreOS. Information specific to this type of virtual machine can be found here.
- Customizable environment variables (ports/logformat/etc).
This project accepts contributions via GitHub pull requests here.
paul91/docker-varnish
is available under the Apache License 2.0. See LICENSE for more details.