Running a dhcp server

I’m trying to run an instance of technitium dns on a nomad cluster. everything works fine except dhcp, which mostly makes sense. However is there a way to get the dhcp broadcasts to the container? I’ve tried host networking mode, but I suspect I’m either not using it correctly and or completely misunderstanding the concept.

job "tsdns01" {
  datacenters = ["dc1"]

  type = "service"

  group "network" {
    count = 1

    network {
      mode = "host"
       port "http" {
         static = 5380
       }
       port "dns" {
         static = 53
       }
       port "dhcp" {
         static = 67
       }
    }

    service {
      name = "${NOMAD_JOB_NAME}-http"
      port = "http"
      provider = "consul"
    }

    task "server" {
      driver = "docker"

      resources {
        cpu    = 300
        memory = 300
      }

      constraint {
        attribute = "${meta.ns01}"
        value     = "true"
      }

      config {
        image = "technitium/dns-server:latest"
        force_pull = true
        ports = ["http", "dns", "dhcp"]
        volumes = [
          "/mnt/nomad-vol/${NOMAD_JOB_NAME}/${NOMAD_TASK_NAME}:/etc/dns"
        ]
      }
    }
  }
}

Hi @tupcakes when using network.mode = "host" with the docker task driver, you must also configure the task.config.network_mode = "host" option. Otherwise docker thinks it should still be doing docker-bridge networking.

it also seems to work with task.config.network_mode = "host" and network.mode not set. I’m guessing network.mode defaults to host if not specified.

in any case thanks.