A dockerized varnish container based on Alpine Linux with SupervisorD
3.2K
Easy to use varnish in a container based on Alpine Linux
$ docker run -d -P \
--link container_name:node1 \
--link container_name2:node2 \
kingsquare/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 node containers you pass and add them to the load balancer, we do this with the setup.sh file. The only requirement is that when you link your containers you use the name nodeN.
$ docker run -d -P \
-e VARNISH_BACKEND_1=google.com:80 -e VARNISH_BACKEND_2=google.dk:80 -e VARNISH_BACKEND_2=192.168.1.1:80 \
kingsquare/varnish
The VARNISH_BACKEND_ identifier will be used to map multiple external backends and ports to seperate backends in the config
Varnish will detect all the defined backends you pass and add them to the load balancer, we do this with the setup.sh file. The only requirement is that when you define them you use the name VARNISH_BACKEND_N.
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_PATH /varnish_storageVARNISH_STORAGE_FILE $VARNISH_STORAGE_PATH/varnish_storage.binVARNISH_STORAGE_SIZE 1GVARNISH_STORAGE malloc,$VARNISH_STORAGE_SIZEVARNISH_TTL 120VARNISH_NCSA_LOGFORMAT "%h %l %u %t %D "%r" %s %b %{Varnish:hitmiss}x "%{User-agent}i""Content type
Image
Digest
Size
44.6 MB
Last updated
over 10 years ago
docker pull kingsquare/varnish-docker