Let's says that we have some backends hosted in Docker containers, with their DNS entries handled by Docker Compose.
With the following docker-compose.yml, it would make the host foo resolve to whatever IP Docker registers the service to when started.
services:
foo:
# ...
Obvisouly, until the container is started, the IP address bound to the alias is not known.
This makes Varnish impossible to start, using such a VCL:
backend foo {
.host = "foo ";
}
VCL compilation failed
Error:
Message from VCC-compiler:
Backend host '"foo"' could not be resolved to an IP address:
Temporary failure in name resolution
(Sorry if that error message is gibberish.)
('/etc/varnish/default.vcl' Line 6 Pos 13)
.host = "foo";
------------#####-
In a world where we have multiple backends for one single Varnish instance, it renders the instance incapable of starting as soon as one container is not up.
I was wondering if there is a way to configure Varnish so that it does not try to resolve the IP at boot-time, and resolve it only when a fetch request to the backend is actually done.