Trying to reference a golang binary from my job, but nomad is looking in /opt/nomad/

Nomad version v1.11.0

job "acmeapp-api" {

  datacenters = ["dc1"]

  type        = "service"




  group "api" {

    count = 1




    network {

      port "http" {

static = 8080

        to     = 8080

      }

    }




    task "api-server" {

      driver = "exec"




      config {

        command = "/opt/acmeapp/bin/acmeapp-api"

      }




...

    }

  }

failed to launch command with executor: rpc error: code = Unknown desc = file /opt/acmeapp/bin/acmeapp-api not found under path /opt/nomad/alloc/92eda276-1b80-4a83-996d-e3b82b27e7c0/api-server

I can confirm the file exists at path /opt/acmeapp/bin/acmeapp-api

But during deployment of the job, nomad creates an alloc and thats’ a dynamic path.

How can I reference this binary file correctly?

Hello. Exec mounts only specific directories. See nomad docunentation of exec task driver and add needed directories there. Configure the Isolated Fork/Exec task driver | Nomad | HashiCorp Developer Or use raw_exec.