This project provides a lightweight, customizable Docker image for Varnish Cacheβ
340
This project provides a lightweight, customizable Docker image for Varnish Cacheβ .
It supports dynamic configuration via environment variables and automatically adds caching headers for optimized image delivery or API response caching.
| Variable | Default | Description |
|---|---|---|
VARNISH_BACKEND_HOST | localhost | Hostname of the backend service |
VARNISH_BACKEND_PORT | 80 | Port of the backend service |
VARNISH_STORAGE | malloc | Storage type (malloc, file, etc.) |
VARNISH_SIZE | 256m | Cache size (e.g., 256m, 1G) |
VARNISH_HTTP_PORT | 80 | Port Varnish will listen on for HTTP |
On container startup, the entrypoint.sh script:
/etc/varnish/default.vcl.templatevarnishd with the generated config and specified cache optionsdocker run -p 8080:80 \
-e VARNISH_BACKEND_HOST=imgproxy \
-e VARNISH_BACKEND_PORT=8080 \
-e VARNISH_STORAGE=malloc \
-e VARNISH_SIZE=512m \
-e VARNISH_HTTP_PORT=80 \
my-varnish-image
services:
varnish:
image: malevichstudio/varnish
ports:
- "8080:80"
environment:
VARNISH_BACKEND_HOST: imgproxy
VARNISH_BACKEND_PORT: 8080
VARNISH_STORAGE: malloc
VARNISH_SIZE: 512m
VARNISH_HTTP_PORT: 80
depends_on:
- imgproxy
imgproxy:
image: malevichstudio/imgproxy
ports:
- "8081:8080"
volumes:
- ./images:/mnt/data:ro
MIT
Content type
Image
Digest
sha256:fb68ed369β¦
Size
143 MB
Last updated
over 1 year ago
docker pull malevichstudio/varnish