Missing network

I have a problem when executing the following command

nomad [plan|run] file

I am currently trying that only the docker containers are connected to each other, regardless of the content of the internal code of the project, but it is impossible, since the network does not want to be built

output:

Captura

code:

job "project" {

  datacenters = ["dc1"]
  type        = "service"
  region = "global"
  constraint {
    attribute = "${attr.kernel.name}"
    value     = "linux"
  }

  group "postgres-project-group" {
    network {
      mode = "bridge"
      port "postgres" {
        to           = 5432
        host_network = "private"
      }
    }
    service {
      name = "project-data-store"
      port = "postgres"
      connect {
        sidecar_service {}
      }
    }
    task "postgres-project-task" {
      driver = "docker"

      config {
        image = "postgres:13.4"
        ports = "db"
      }
      env {
        POSTGRES_PASSWORD = "project-password"
        POSTGRES_DB       = "project"
      }

      resources {
        cpu    = 2000
        memory = 2000
      }
    }
  }

  group "ms-project-group" {
    count = 1
    network {
      mode = "bridge"
      port "project" {
        to           = 5000
        host_network = "private"
      }
    }
    service {
      name = "ms-project"
      connect {
        sidecar_service {
          proxy {
            upstreams {
              destination_name = "project-data-store"
              local_bind_port  = 5432
            }
          }
        }
      }
    }
    task "ms-project-task" {
      driver = "docker"

      config {
        image = "docker/project"
        port  = "project"

      }

      resources {
        cpu    = 100
        memory = 100

      }
    }
  }
}


Hi @oscarcq and thanks for the detail in this question. In order to utilise a host_network within a job specification like you have, you need to define this within the client configuration as per the host_network client stanza documentation. Do you have this configured for your client and your hosts, and if so, could you please share this configuration so I can investigate a little further?

Thanks,
jrasell and the Nomad team

The truth is, I did not have a client configured, currently the client I was running was the nomad agent -dev-connect
.

on the other hand, I have tried removing the host_network but it doesn’t work anyway, that message appears when I put the network in bidge mode