This image is intended to provide a caching and load balancing layer in front of web containers.
$ docker run -d -P \
--link container \
--link another_container \
creativearea/varnish
To run the container you need to link the containers you want to run behind the load balancer that Varnish will create. Varnish will detect all the backend containers you pass and will add them to the load balancer. The only requirement is that your linked backends expose the port 80.
Varnish will use the following environment variables. You can override them if you want
VARNISH_VCL_CONF
/etc/varnish/default.vclVARNISH_LISTEN_ADDRESS
0.0.0.0VARNISH_LISTEN_PORT
80VARNISH_ADMIN_LISTEN_ADDRESS
0.0.0.0VARNISH_ADMIN_LISTEN_PORT
6082VARNISH_MIN_THREADS
1VARNISH_MAX_THREADS
1000VARNISH_THREAD_TIMEOUT
120VARNISH_SECRET_FILE
/etc/varnish/secretVARNISH_STORAGE
malloc,100MVARNISH_TTL
120VARNISH_NCSA_LOGFORMAT
"%h %l %u %t %D "%r" %s %b %{Varnish:hitmiss}x "%{User-agent}i""
- The VCL config is based on Mattias Geniar Varnish 4 configuration templates