Skip to content

Instantly share code, notes, and snippets.

@schmichael
Created March 30, 2022 18:09
Show Gist options
  • Save schmichael/de8b1f5a92fc2d2a576560f3560aba3b to your computer and use it in GitHub Desktop.
Save schmichael/de8b1f5a92fc2d2a576560f3560aba3b to your computer and use it in GitHub Desktop.
client {
host_network "public" {
cidr = "192.168.86.227/32"
}
}
job "example" {
datacenters = ["dc1"]
group "cache" {
network {
port "db" {
to = 6379
host_network = "public"
}
}
task "redis" {
driver = "docker"
config {
image = "redis:3.2"
ports = ["db"]
}
resources {
cpu = 500
memory = 256
}
}
}
}
sudo -E nomad agent -dev -config hostnet.hcl
# In another terminal
nomad run hostnet.nomad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment