converge
converge copied to clipboard
Easily reference exposed ports in docker module
This would add a "ports" field to lookup that would have an exposed port as a key, and the value would be the port assigned to it on the host. This would work the same whether the host port was manually or automatically assigned. The syntax would be something like this:
docker.container "nginx" {
expose = ["80", "433"]
}
task "curl nginx container" {
check = "curl {{lookup `docker.container.nginx.ports.80`}}"
...
}
Just as a note, the recommended docker syntax for printing the host port of a container is this invocation of docker inspect:
docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
to this effectively, we also need to be able to do a lookup on map fields.