Creating persistent sessions/containers with Nomad

Hi folks,

I’m starting with Nomad and I’m trying to create a system where you can request an addressable session/container from the outside and Nomad will then deploy this session and expose this session to the outside world.

My first idea is to create a custom driver that handles this provisioning. Maybe there is already a way to do this?

Can you please give me high-level advice about what is the best way to do this?

Thank you for any feedback!

Hey @ValentaTomas

Welcome to the nomad community!

Sounds like an interesting project ! At the high level, without knowing any of your specific requirements, Nomad would definitely be able to do this. I don’t think you’d even need to create a custom driver. Based on my understanding of what you said, you could -

  • Host an application in Nomad where users can " request a session "
  • Have it be accessed through a load balancer like NGINX ( see our load balancing integrations )
  • On user request, deploy a nomad job based on a template ( see templating )
  • Expose those jobs through load balancing as well

Could you give more context into the UX you’re trying to achieve? It seems like you’d only need the docker driver, is there something that the docker driver doesn’t have that you’d need for this project?

1 Like

Thank you Amier! This sounds like a reasonable setup and I’m already prototyping something very similar.

The UX should be like this:

  1. User opens a page
  2. A session (this will be probably a Firecracker VM in the end) on our backend for that user automatically spins up
  3. The session should have an address and the user should be able to interact with it however he wants
  4. User closes the page and the session dies

Do you have any other advice, please?


Hey, I wanted to ask how would you implement the dynamic routing to sessions.

I have multiple dynamic services running on a node and they have their own dynamic local IP addresses (for example They are all reachable from the node’s host namespace but I also create new network namespaces for each service manually – can we propagate this information to Consul and use it for routing the request with some built-in Nomad features?

How would I register these services with Consul so I can route traffic to them from some central proxy?

I also created this question – Dynamic routing based on URL - #2 by foozmeat, do you think that solution is a good fit?