Task not restarted on changed template from host system (Env, Docker, disabled file sandbox)

I’m currently having issues with external files not being detected as changed.

In this task, I need to make environment variables from an external file available in a Docker container. On the Nomad client I’ve disabled the client sandbox so the .env file from the host system is available.

The two issues I’m currently facing:

  • If I edit the /mnt/.env file Nomad does not detect the change and won’t restart the job.
  • When I manually restart the job (nomad alloc restart ... OR via the UI) the file contents won’t change (Same file contents in the UI, same environment values available in the container)

How can I restart an alloc/task and also make Nomad to refresh the file contents?

Furthermore, is there a way to make Nomad respect the change_mode and restart the task when the host system file has changed?

Thanks!

The job

job "redacted" {
  group "frontend" {
    task "node" {
      driver = "docker"

      config {
        image = "redacted"
        ports = ["http"]
      }

      template {
        source      = "/mnt/.env" # on host system
        destination = "local/.env"
        env         = true
        change_mode = "restart"
      }
    }
  }
}