I have Nomad installed on a VPS. When I run a task nomad creates a docker container which is directly exposed to the public internet.
Current Behaviour
However if I try to reach it on 127.0.0.1:<port>
or 0.0.0.0:<port>
it is not available. It is available from inside the VPS and outside using <public_ip>:<port>
.
Expected Behaviour
It cannot be reached from the internet using <public_ip>:<port>
but it can be reached from inside the VPS using 127.0.0.1:<port>
or 0.0.0.0:<port>
Nomad Config File
data_dir = "/root/nomad/data"
bind_addr = "0.0.0.0"
server {
enabled = true
bootstrap_expect = 1
}
client {
enabled = true
servers = ["127.0.0.1"]
}
acl {
enabled = true
}
Job File
job "echo-app" {
datacenters = ["dc1"]
group "web" {
count = 1
network {
port "appHttp" {
to = 8080
}
}
service {
provider = "nomad"
port = "appHttp"
name = "echo-web-http"
}
task "echo-server" {
driver = "docker"
config {
image = "mendhak/http-https-echo:26"
ports = [
"appHttp"
]
}
resources {
cpu = 100
memory = 200
}
}
}
}
How my network interfaces look
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 00:50:56:4e:2e:6f brd ff:ff:ff:ff:ff:ff
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether 02:34:7a:1d:69:e9 brd ff:ff:ff:ff:ff:ff
7: veth0ad3ded@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP mode DEFAULT group default
link/ether 12:d7:56:da:bc:5f brd ff:ff:ff:ff:ff:ff link-netnsid 0