https://github.com/bvis/docker-varnish
Docker image to generate varnish containers where the VCL config can be split as you want
https://github.com/bvis/docker-varnish
docker-image varnish vcl
Last synced: about 1 year ago
JSON representation
Docker image to generate varnish containers where the VCL config can be split as you want
- Host: GitHub
- URL: https://github.com/bvis/docker-varnish
- Owner: bvis
- Created: 2016-07-15T14:01:23.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-04T15:59:32.000Z (over 7 years ago)
- Last Synced: 2025-02-14T05:29:51.850Z (over 1 year ago)
- Topics: docker-image, varnish, vcl
- Language: VCL
- Homepage: https://hub.docker.com/r/basi/varnish/
- Size: 2.63 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](http://microbadger.com/images/basi/varnish "Get your own image badge on microbadger.com") [](http://microbadger.com/images/basi/varnish "Get your own version badge on microbadger.com")
# basi/varnish
From the Debian Jessie distribution it installs a Varnish daemon.
### Varnish
It allows you to use an specific VCL file when you provide an environment variable named: `$VCL_CONFIG`. But
you can provide a directory instead of a file and the system internally will merge all the "vcl" files found in
the directory to create the VCL file that will be used by Varnish.
This approach is useful when you have complicated Varnish logic, and it allows to use small consul-template templates.
As the provided VCL is split in pieces you can overwrite each piece individually in your container or the entire
directory.
## Example of use
### Provide a directory with the logic split in files
docker run --rm -it -P --add-host web:127.0.0.1 \
-v $PWD/rootfs/etc/varnish/conf.d/:/etc/varnish/conf.d/ \
-e VCL_CONFIG=/etc/varnish/conf.d \
basi/varnish
It will use the VCL files contained in the volume instead of the originally available files provided by the image.
If you want to change one VCL status you just need to to it with:
docker run --rm -it -P --add-host web:127.0.0.1 \
-v $PWD/rootfs/etc/varnish/conf.d/30-vcl_deliver.vcl:/etc/varnish/conf.d/30-vcl_deliver.vcl \
-e VCL_CONFIG=/etc/varnish/conf.d \
basi/varnish
And it will just switch just the logic executed in the vcl_deliver status by yours.
### Provide a full VCL file
Another possibility is just give to the system a full VCL file. The needed parameters would be something similar to:
docker run --rm -it -P --add-host web:127.0.0.1 \
-v $PWD/rootfs/etc/varnish/default.vcl:/etc/varnish/default.vcl \
-e VCL_CONFIG=/etc/varnish/default.vcl \
basi/varnish
NOTE: As you may see in the examples the "web" name is resolved as localhost, usually you will provide your service name in the VCL.
### Basic header debugging
If in your request you include the header: `X-Cache-Debug: u0AJAlRWN4` you can get extra headers in your response.
You can change the default secret value using an environmental variable.
### Other supported parameters:
`$CACHE_SIZE`: Determines the cache size used by varnish
`$VARNISHD_PARAMS`: Other parameters you want to pass to the varnish daemon
`$VARNISH_DEBUG_SECRET`: Change the default debug password