Running task with "ubuntu" user

I’m trying to run a task using exec and as user ubuntu but I’m seeing that the ubuntu user home directory doesn’t seem to exist.

Something like this:

config {
        command = "/bin/bash"
        args = ["-c", <<EOT
          whoami
          ls -l /home/ubuntu
        EOT
        ]
      }

Will output “ubuntu”, but “cannot access ‘/home/ubuntu’: No such file or directory”.

I’ve just started using Nomad, so I’m sure I’m missing quite a bit, but any help would be greatly appreciated.

Hi. Exec mounts or copies(!) only directories listed in the chroot_env config. Kindly read Drivers: Exec | Nomad | HashiCorp Developer .

There is also exec2 driver and raw_exec driver that you might be interested.

There is also exec2 driver

Just to follow up, the exec2 driver might be a good fit since it is oriented around making use of the host file system. You’d specify the unveil paths to include the home directory, e.g.

config {
    command = "..."
    unveil = ["rw:/home/ubuntu"]
}

Depending on your system configuration it may be substantially more efficient than creating a copy in a chroot like with the original exec driver.

Thanks Seth, this is also very helpful

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.