Created
July 6, 2023 08:19
-
-
Save mr-karan/50599231f2423189f470028965762d57 to your computer and use it in GitHub Desktop.
Simple job to demonstrate Nomad tasks sharing namespace network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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