I am using Consul 1.6.x for Service Discovery and everything works great since my Consul-Service configuration points to an application that runs on port 8000.
Now that I am running my services through Nomad(application runs on dynamic ports). How to tell nomad to reconfigure the Consul Service to check on the dynamic port.
Any direction is much appreciated.
using port_map
coupled with the service
stanza will do it for “auto-magically” for you.
btw, what type of task? (i guess docker
) . Could you provide the minimal job definition (remove anything sensitive)
I am using port_map
to expose 2 ports from the container(port 80, 81). However, I do still like the idea of Docker exposing the ports into dynamic ports but would like Consul to know about.
Defining a service with a health check should do it: