I´m having trouble getting networking to work. I am new to using/setting up Nomad, so I´m not sure about how it is supposed to work.
I have created 2 networks with Docker, bound to 2 different interfaces.
docker network create --attachable -d transparent -o com.docker.network.windowsshim.networkname=dmz -o com.docker.network.windowsshim.interface="dmz" dmz
docker network create --attachable -d transparent -o com.docker.network.windowsshim.networkname=prod -o com.docker.network.windowsshim.interface="Ethernet" prod
I have created 2 networks in Nomad and bound them to the networks created with Docker
host_network "prod" {
interface = "vEthernet (Ethernet)"
}
host_network "dmz" {
interface = "vEthernet (dmz)"
}
However when I deploy a job in Nomad, they all use the default “nat” network created by Docker.
Shouldn´t they use the network specified in the network section of the job file??
Or am I missing some configuration somewhere?
Do I need to specify more in the job file?
job "dashboard01" {
datacenters = ["dc01"]
update {
max_parallel = 3
health_check = "checks"
min_healthy_time = "10s"
healthy_deadline = "20m"
progress_deadline = "25m"
auto_revert = false
auto_promote = false
canary = 0
stagger = "30s"
}
group "dashboard01" {
network {
port "http" {
to = "80"
host_network = "prod"
}
}
task "dashboardweb01" {
service {
name = "dashboard"
port = "http"
check {
type = "http"
path = "/"
port = "http"
interval = "10s"
timeout = "2s"
}
}
driver = "docker"
config {
image = "registry.local:5000/dashboard:20210830104951"
image_pull_timeout = "20m"
ports = ["http"]
hostname = "dashboard"
}
}
scaling {
enabled = true
min = 1
max = 8
policy {
}
}
}
}
Using Nomad 1.1.4, Docker 20.10.7 and Windows Server 2019