I have 2 containers in a nomad group. How can I make it so they communicate over a loopback interface without registering the service in consul?
job "foobar" {
datacenters = ["dc1"]
group "foo" {
volume "puppet-certs" {
type = "host"
config {
source = "puppet-certs"
}
}
task "corvus" {
driver = "docker"
config {
image = "gitlab.example.com:4567/example/corvus:0.2.7"
entrypoint = [" /go/bin/corvus"]
args = [
"--nodes",
"redis.service.consul:6379",
"--bind",
"8379",
"/dev/null"
]
}
resources {
network {
port "corvus" {
static = "8379"
}
}
}
}
task "redis-cli" {
driver = "docker"
config {
image = "redis:4.0.10"
command = "/bin/sleep"
args = ["10000"]
}
}
}
}
I then log into the redis-cli and try and query the other container on the loopback
nomad alloc exec -task redis-cli -job foobar /bin/bash
$ redis-cli ping -p 8379 #no response