varnish-docker
varnish-docker copied to clipboard
What if i need to run using docker-compose
Is there a way to run it without specify -i and so run varnish in foreground? This is a problem if you're using docker-compose i suppose. I think that something like that (in start.sh)
exec bash -c "exec varnishd -F -f /etc/varnish/default.vcl -s malloc,100M -a 0.0.0.0:${VARNISH_PORT}"
could work.
Old issue/question, but here's an answer:
You don't need to change the command if running from Compose. Just have compose start the container:
data:
image: busybox
volumes:
- /opt/docker/varnish/var:/var/lib/varnish
- /opt/docker/varnish/etc:/etc/varnish
varnish:
image: yourname/varnish
volumes_from:
- data
ports:
- "8000:80"
environment:
VARNISH_PORT: 80
VARNISH_BACKEND_IP: 1.2.3.4
VARNISH_BACKEND_PORT: 80
The included start.sh
runs varnish
(which goes into the background) and then runs varnishlog
as the foreground process. This allows you to get logs from varnish by using docker logs
or docker-compose logs
(though the latter lacks options for tail and follow and will blast your screen with more data than you can process).
This is not an issue and should be closed.