Closed zakabluk closed 3 years ago
Hi @zakabluk! I suspect this was fixed by https://github.com/hashicorp/nomad/pull/8822, which hasn't made it into the changelog for the upcoming 0.13.0 yet. Can you try this same jobspec against the current master?
@zakabluk just wanted to follow up on this. With the current Nomad 1.0.0-rc I was able to verify this works. Something I noticed while trying it was that you don't have a ports
configuration for the container, so Docker isn't getting the port mapping you need. See this simplified example:
job "example" {
datacenters = ["dc1"]
group "www" {
network {
port "www" {
to = 8001
static = 80
host_network = "alternate"
}
}
task "httpd" {
driver = "docker"
config {
image = "busybox:1"
command = "httpd"
args = ["-v", "-f", "-p", "8001", "-h", "/www"]
volumes = ["/tmp/www:/www:ro"]
ports = ["www"]
}
resources {
cpu = 256
memory = 128
}
}
}
}
$ nomad job run ./example.nomad
==> Monitoring evaluation "bb287821"
Evaluation triggered by job "example"
==> Monitoring evaluation "bb287821"
Evaluation within deployment: "c4643fd3"
Allocation "d075fbf8" created: node "300e0a23", group "www"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "bb287821" finished with status "complete"
$ nomad alloc status d07
...
Allocation Addresses
Label Dynamic Address
*www yes 10.199.0.11:80 -> 8001
...
vagrant@nomad-server01$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c26dc55c0d6b busybox:1 "httpd -v -f -p 8001…" 3 seconds ago Up 2 seconds 10.199.0.11:80->8001/tcp, 10.199.0.11:80->8001/udp httpd-d075fbf8-b40b-0432-8c8f-fa4c552e930b
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
I try use multi network. I have two network interfaces. I created host_network at client configuration.
And added to job file config
and afrer launched my job I got:
but when I get information about docker container
I inspected my monad job
I expected that my nginx will be work on public ip and use port 8080 instead 80 which set in docker container.
Nomad version
Nomad v0.12.5
Operating system and Environment details
Debian 5.7.10-1~bpo10+1
Issue
Reproduction steps
create in client config host_network and launch job.
Job file (if appropriate)