Is there a way, I can make a bridge network between two job groups?

So, I have a docker-compose file like below

version: '2'

services:
    ignite:
        image: ig-prod-zk:1.0
    ignite-client:
        image: igc-zk:1.0
        ports:
            - 8080:8080

I then execute docker-compose scale ignite=3. This creates 3 instances of ignite and 1 instance of client.

job "ignite-cluster" {
    datacenters = ["dc1"]
    type = "service"
    group "ignite-server" {
        count = 3
        network {
            mode = "bridge"
        }
        task "ignite" {
            driver = "docker"
            config {
                image = "ig-prod-zk:1.0"
                volumes = ["/opt/data/ig:/opt/data/ig"]
            }
            resources {
                cpu    = 500
                memory = 512
            }
            service {
                name = "ignite"
            }

        }
    }

    group "igc" {
        network {
            port "igcp" {
                static = "8080"
            }
        }
        task "ignite-client" {
            driver = "docker"
            config {
                image = "igc-zk:1.0"
                ports = ["igcp"]
                volumes = ["/opt/data/ig:/opt/data/ig"]

            }
            resources {
                cpu    = 500
                memory = 512
            }
            service {
                name = "ignite-client"
            }
        }
    }
}


Hi @agarwal-nitesh, the bridge network is tied directly to the lifecycle of the allocation of the group it’s defined in. As such there is no way to (via Nomad) to share the network across groups. Doing so wouldn’t really make sense either, as there is no guarantee the groups would be placed on the same Client node to begin with.

For advanced software defined networking needs, Nomad does support CNI plugins.

1 Like