Invalid wait time in url

When my consul-template in the nginx container attempts to get the healthy endpoints from my consul container, it errors out because of an error in the url: health.service(platformui|passing): Get http://localhost:8500/v1/health/service/platformui?passing=1&stale=&wait=60000ms: dial tcp 127.0.0.1:8500: connect: connection refused (retry attempt 4 after “2s”)

This is running on two separate containers on one ubuntu host. If I go to the specified url in my browser, it works just fine as long as I remove the trailing “:”. I’m new to consul, so I’m not sure exactly what I have misconfigured.

I’m using consul-template from https://releases.hashicorp.com/consul-template/0.24.1/consul-template_0.24.1_linux_amd64.tgz

My template looks like:

consul {
address = “http://consul:8500
retry {
enabled = true
attempts = 12
backoff = “250ms”
}
}
template {
source = “/etc/nginx/conf.d/load-balancer.conf.ctmpl”
destination = “/etc/nginx/conf.d/load-balancer.conf”
perms = 0600
command = “service nginx reload”
}

Your nginx container tries to connect to localhost to find Consul, but should connect to the other container. Usually, the default docker ip range is 172.17. 0.0/16 . You should docker inspect <consul-container> getting its ip and configure consul-template to use this ip for connecting to Consul.
It is working from your host because the port 8500 is exposed, I guess. But if you nginx isn’t running locally, but in a container instead, you should use the inspected ips.

Ah, that was it. Thank you for the help!