Job-level network? Docker Network -> Nomad Network?

Hi:
I’m new to Nomad and I’m trying to convert a docker-compose config into Nomad. I have some difficulties dealing with networking in Nomad and I’d really appreciate your help!
I have a docker-compose file looks like below:


In docker-compose I can create a network and the containers can ping to each other using container’s name. I’d like to achieve the same goal in Nomad. If I have 2 services from different group, how do I add them to the same network and allow them ping each other using service’s name? I read that I could use consul to query the service address, but it’s not what I want here…

If I have 2 services from different group, how do I add them to the same network and allow them ping each other using service’s name?

Hi @chaolunxu, the simple host-specific network model used by docker-compose doesn’t make sense in an environment with more than one node - which is what Nomad is made for. There cannot be a “job level network”, because each group specified in a job could end up running on a different machine entirely.

Luckily starting with Nomad v1.3 you no longer need Consul for basic service discovery, as Nomad now has support for service discovery built in.

Hi Seth, thank you so much for your reply! Is there any work around to this problem? I saw that CNI might be a solution to this?