Image is named
fpfis/varnish and are based on Ubuntu.
The following vmods have been included :
||Port to listen on||
||Maximum memory to use for caching||
||YAML file to read backend config||
The backend must be defined in a YAML file mounted as a volume.
The syntax is as follow :
varnish: sites: default: nodes: - host: web port: 8080
varnish: sites: site1: path: /site1 base64auth: pxosizjpiweqw nodes: - host: web01 port: 8888 - host: web02 port: 8888 site1static: path: /site1/static base64auth: pxosizjpiweqw nodes: - host: web01 port: 8889 - host: web02 port: 8889 site2: path: /site2 base64auth: pxosizjpiweqw nodes: - host: web03 port: 8888 - host: web04 port: 8888 site2static: path: /site2/static base64auth: pxosizjpiweqw nodes: - host: web03 port: 8889 - host: web04 port: 8889
VCL must be mounted in
/etc/varnish and a
default.vcl should be present.
You should also make sure to include
/tmp/directors.vcl in your VCL to setup the backends.
Assuming you have a working VCL with
default.vcl in your local
varnish folder :
docker run -p 8086:8086 -ti --rm -e YAML_CONF=/yaml.conf -v $(pwd)/config.yaml:/config.yaml -v $(pwd)/varnish:/etc/varnish fpfis/varnish:4.1