Clarifications for a nomad newbie

Hi all, so far I have been working with docker and docker compose / swarm. Simple projects, nothing extremely elaborate.
I am new to the hashicorp world.
I did the first tutorials of nomad but I still can’t understand some things.

I would like to create a simple job that runs a youtrack container. The docker compose I use is this:

version: ‘3’

image: jetbrains/youtrack:2022.1.45133
- 8080:8080
- data:/opt/youtrack/data
- conf:/opt/youtrack/conf
- logs:/opt/youtrack/logs
- backups:/opt/youtrack/backups
restart: unless-stopped


I don’t understand how I should declare volumes, how should I map ports and finally if I need a task group, or I can just declare the job and a “youtrack” task

I have to admit that nomad is intimidating, but it is likely that I am not able.

Thanks to anyone who can give me a hand or an indication where to start.

Hi @sassodev

So first you should remember, nomad “is not docker only” that is why the job definition is more generic. I haven’t used docker swarm myself but in nomad if you apply a job, nomad tries to place the job where it can fulfill the constraints. Persistent workloads (volumes) is a bit of an advanced setup because, you need either define host volumes on one node or have CSI in place.

Also see Stateful Workloads with Nomad Host Volumes | Nomad - HashiCorp Learn

To create a simple job template use nomad job init [-short]
then modify it to get something like (without the volumes):

job "youtrack" {
  datacenters = ["dc1"]
  namespace = "default"

  group "youtrack" {
    network {
      port "web" {
        static = 8080

    task "youtrack" {
      driver = "docker"

      config {
        image = "jetbrains/youtrack:2022.1.45133"
        ports = ["web"]

      resources {
        cpu    = 500
        memory = 256

note that I set the port to “static” which works for small things but in the long run you would want an ingress controller and which route the http request to the nomad node running the container.

      port "web" {
       to = 8080

I would create another job for an ingress controller (web proxy) like traefik which has nomad and consul support and this web proxy only has the static port on 80

Thank you very much resmo, now everything is much clearer to me. I was trying to put the pieces together in my head and visualizing a simple job like this gave me a better understanding of how nomad works.

I guess the host volumes can be mounts to nfs shares, I’ll check.

I have read the documentation of the csi plugins, yes, it seems quite advanced, but thanks for pointing this out to me too