6.3.0
,6.3
,6
,latest
6.3.0-vmods
,6.3-vmods
,6-vmods
,vmods
6.2.1
,6.2
6.1.1
,6.1
6.0.4
,6.0
5.2.1
,5.2
,5
5.1.3
,5.1
5.0.0
,5.0
Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any HTTP server and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. You can read a general overview of The Big Varnish Picture in the official Varnish documentation. |
This is just a lightweight and easy to use Varnish image for Docker. It is based on Debian Stretch Slim and its size on disk is around 162MB.
A special variant (-vmods
) with some of the most popular Varnish modules
(VMODS) is also provided.
To test our image quickly we could just run a simple container like this:
$ docker run -p 8080:8080 ernestojpg/varnish
This will start a very simple Varnish container listening on port 8080
and returning a static message. So now, if we open the
URL http://localhost:8080
in our browser we should see something like this:
Hello from Varnish!
For real-life applications we will need to use our own VCL file.
The simplest way of doing that is to mount our VCL file in the default path /etc/varnish/default.vcl
inside the container
when we run it. For example:
$ docker run -v my_custom_config.vcl:/etc/varnish/default.vcl -p 8080:8080 ernestojpg/varnish
Note that we can mount multiple VCL files or even a complete folder if needed.
We can also pass some environment variables when running a new container for configuring some parameters:
VARNISH_LISTEN_ADDRESS
: The address where Varnish will listen to. The address can be a host name ("localhost"), an IPv4 dotted-quad ("127.0.0.1"), or an IPv6 address enclosed in square brackets ("[::1]").
Default: Empty. Varnish will listen on all available IPv4 and IPv6 interfaces.VARNISH_LISTEN_PORT
: The port where Varnish will listen to.
Default:8080
VARNISH_VCL_CONF
: Path to the default VCL file.
Default:/etc/varnish/default.vcl
VARNISH_PID_FILE
: Path to the varnishd process PID file.
Default:/var/run/varnish.pid
DAEMON_OPTS
: Any extra option we want to pass when starting the varnishd process. More information in the varnishd official documentation.
Default: Empty. No extra parameters are passed.
Currently ernestojpg/varnish
images come in two different flavours, each designed for a specific use case.
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one.
Special variant that also includes some of the most popular Varnish modules (VMODS), keeping the image size down to the bare minimum (162MB on disk).
The additional modules installed are:
- Varnish-Modules from Uplex
- vmod_bodyaccess: Varnish module that lets you access the request body.
- vmod_cookie: Handle HTTP cookies easier in Varnish VCL.
- vmod_header: Varnish Module for manipulation of duplicated HTTP headers.
- vmod_saintmode: Saintmode lets you deal with a backend that is failing in random ways for specific requests.
- vmod_tcp: The TCP vmod opens for access and modification of client TCP connection attributes from VCL.
- vmod_var: This VMOD implements basic variable support in VCL.
- vmod_vsthrottle: A Varnish vmod for rate-limiting traffic on a single Varnish server.
- vmod_xkey: This vmod adds secondary hashes to objects, allowing fast purging on all objects with this hash key.
- VMOD Blobdigest from Uplex
- vmod_blobdigest: This Varnish Module (VMOD) generates message digests, keyed-hash message authentication codes (HMACs) and checksums using the VCL data type BLOB.
- VMOD Parseform
- vmod_parseform: Provides easy access to fields in Form POST requests.
Because compatibility reasons, each varnish image version comes with different versions of the VMODS.
In the following table we can see the installed VMODS for each of the varnish images (-vmods
variant):
Varnish | Varnish-Modules | VMOD Blobdigest | VMOD Parseform |
---|---|---|---|
6.3.0 | 6.2-20190417 | 6.2-20190314 | master-20190919 |