diff --git a/varnish/README.md b/varnish/README.md index 3a58ec805..665eda1c3 100644 --- a/varnish/README.md +++ b/varnish/README.md @@ -93,7 +93,24 @@ Place this file in the same directory as your `default.vcl`, run `docker build - $ docker --tmpfs /var/lib/varnish:exec my-varnish ``` -### Additional configuration +## Reloading the configuration + +The images all ship with [varnishreload](https://github.com/varnishcache/pkg-varnish-cache/blob/master/systemd/varnishreload#L42) which allows you to easily update the running configuration without restarting the container (and therefore losing your cache). At its most basic, you just need this: + +```console +# update the default.vcl in your container +docker cp new_default.vcl running_container:/etc/varnish/default.vcl +# run varnishreload +docker exec running_container varnishreload +``` + +Note that `varnishreload` also supports reloading other files (it doesn't have to be `default.vcl`), labels (`l`), and garbage collection of old labeles (`-m`) among others. To know more, run + +```console +docker run varnish varnishreload -h +``` + +## Additional configuration By default, the containers will use a cache size of 100MB, which is usually a bit too small, but you can quickly set it through the `VARNISH_SIZE` environment variable: @@ -121,7 +138,7 @@ $ docker run varnish varnishd -x parameter $ docker run varnish varnishd -a :8080 -b 127.0.0.1:8181 -t 600 -p feature=+http2 ``` -### Exposing the port +## Exposing the port ```console +$ docker run --name my-running-varnish --tmpfs /var/lib/varnish:exec -d -p 8080:80 my-varnish