Run docker job, need help

Hello, I’m new to this whole cluster thing. I recently purchased a sipeed nanocluster which is essentially 7 nodes and setup Nomad roughly following this playbook. So with that said, this is my first experience with any clustering.

I’m trying to setup Actual Budget as a job. Following some tutorials online, I created a dynamic host volume.

My job file looks like this

job "actual-budget" {
  # Specifies the datacenter where this job should be run
  # This can be omitted and it will default to ["*"]
  datacenters = ["*"]

  meta {
    # User-defined key/value pairs that can be used in your jobs.
    # You can also use this meta block within Group and Task levels.
    foo = "bar"
  }

  # A group defines a series of tasks that should be co-located
  # on the same client (host). All tasks within a group will be
  # placed on the same host.
  group "servers" {

    # Specifies the number of instances of this group that should be running.
    # Use this to scale or parallelize your job.
    # This can be omitted and it will default to 1.
    count = 1
    
    # claim the dynamic host volume for the allocation
    volume "groupvol" {
      type            = "host"
      source          = "actual-budget"
      access_mode     = "single-node-single-writer"
      attachment_mode = "file-system"
    }

    network {
      port "www" {
        to = 5006
      }
    }

    service {
      provider = "nomad"
      port     = "www"
    }

    # Tasks are individual units of work that are run by Nomad.
    task "webservice" {
      driver = "docker"

      config {
        image = "docker.io/actualbudget/actual-server:latest"
        labels {
          group = "webservice-cache"
        }
        command = "docker run --pull=always --restart=unless-stopped -d -p 5006:5006 -v /srv --name my_actual_budget actualbudget/actual-server:latest"
      }
      
      # Specify the maximum resources required to run the task
      resources {
        cpu    = 50
        memory = 64
      }
      # mount the claimed volume to the task
      volume_mount {
        volume      = "groupvol"
        destination = "/srv"
      }
    }    
  }
}

If I comment out command the job will run, but the container website does not start. If command is left in it fails to run the job with a 127 exit code. I’m not sure what I’m doing wrong.

On my non-cluster hosted pi I use the docker-compose method of starting. Any help would be appreciated.

Hi @atrueresistance,

The command parameter is not a direct mirror of the Docker command you pass to the Docker API via the CLI. It’s just the command to run inside the container, once Nomad has started it for you. The port and volume mapping are also handled by Nomad and wrapped in its own configuration.

The job specification Docker driver configuration options would be a good bit of suggested reading, as well as the network and volume sections.

Thanks,
jrasell and the Nomad team