'The Nomad agent runs on every node and listens to http port 4646
See https://www.nomadproject.io/docs/http/agent-self.html
We\'ll use the unauthenticated endpoint /v1/agent/self
We don\'t have any envvars or downwards API to help us, so we try
default gw (network=bridge) and localhost (network=host), but can\'t
auto-detect more complicated cases
We need the agent to listen to 0.0.0.0, which is not the case on a devnode'

def _detect_agent(self):

    urls = []
    gw = self.docker_util.get_gateway()
    if gw:
        urls.append((NOMAD_AGENT_URL % gw))
    urls.append((NOMAD_AGENT_URL % '127.0.0.1'))
    nomad_url = self._try_urls(urls, validation_lambda=NomadUtil.nomad_agent_validation)
    if nomad_url:
        self.log.debug(('Found    Nomad    agent    at    ' + nomad_url))
    else:
        self.log.debug(('Could    not    find    Nomad    agent    at    urls    ' + str(urls)))
    return nomad_url
