Skip to content

Instantly share code, notes, and snippets.

@mr-karan
Created July 6, 2023 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr-karan/50599231f2423189f470028965762d57 to your computer and use it in GitHub Desktop.
Save mr-karan/50599231f2423189f470028965762d57 to your computer and use it in GitHub Desktop.
Simple job to demonstrate Nomad tasks sharing namespace network
job "http_servers" {
datacenters = ["dc1"]
group "group" {
network {
mode = "bridge"
port "taskA" {
static = 6000
}
port "taskB" {
static = 7000
}
}
task "taskA" {
driver = "docker"
config {
image = "python:3.11"
command = "python"
args = ["-m", "http.server", "${NOMAD_PORT_taskA}"]
}
}
task "taskB" {
driver = "docker"
config {
image = "python:3.11"
command = "python"
args = ["-m", "http.server", "${NOMAD_PORT_taskB}"]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment