github.com/dkerwin/nomad@v0.3.3-0.20160525181927-74554135514b/website/source/docs/drivers/exec.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Drivers: Exec"
     4  sidebar_current: "docs-drivers-exec"
     5  description: |-
     6    The Exec task driver is used to run binaries using OS isolation primitives.
     7  ---
     8  
     9  # Isolated Fork/Exec Driver
    10  
    11  Name: `exec`
    12  
    13  The `exec` driver is used to simply execute a particular command for a task.
    14  However, unlike [`raw_exec`](raw_exec.html) it uses the underlying isolation
    15  primitives of the operating system to limit the tasks access to resources. While
    16  simple, since the `exec` driver  can invoke any command, it can be used to call
    17  scripts or other wrappers which provide higher level features.
    18  
    19  ## Task Configuration
    20  
    21  The `exec` driver supports the following configuration in the job spec:
    22  
    23  * `command` - The command to execute. Must be provided. If executing a binary
    24    that exists on the host, the path must be absolute. If executing a binary that
    25    is download from an [`artifact`](/docs/jobspec/index.html#artifact_doc), the
    26    path can be relative from the allocations's root directory.
    27  
    28  *   `args` - (Optional) A list of arguments to the optional `command`.
    29      References to environment variables or any [intepretable Nomad
    30      variables](/docs/jobspec/interpreted.html) will be interpreted
    31      before launching the task. For example:
    32  
    33      ```
    34          args = ["${nomad.datacenter}", "${MY_ENV}", "${meta.foo}"]
    35      ```
    36  
    37  ## Examples
    38  
    39  To run a binary present on the Node:
    40  
    41  ```
    42    task "example" {
    43      driver = "exec"
    44  
    45      config {
    46        # When running a binary that exists on the host, the path must be absolute
    47        command = "/bin/sleep"
    48        args = ["1"]
    49      }
    50    }
    51  ```
    52  
    53  To execute a binary downloaded from an [`artifact`](/docs/jobspec/index.html#artifact_doc):
    54  
    55  ```
    56    task "example" {
    57      driver = "exec"
    58  
    59      config {
    60        command = "binary.bin"
    61      }
    62  
    63      artifact {
    64        source = "https://dl.dropboxusercontent.com/u/1234/binary.bin"
    65        options {
    66          checksum = "sha256:abd123445ds4555555555"
    67        }
    68      }
    69    }
    70  ```
    71  
    72  ## Client Requirements
    73  
    74  The `exec` driver can only be run when on Linux and running Nomad as root.
    75  `exec` is limited to this configuration because currently isolation of resources
    76  is only guaranteed on Linux. Further the host must have cgroups mounted properly
    77  in order for the driver to work.
    78  
    79  If you are receiving the error `* Constraint "missing drivers" filtered <> nodes`
    80  and using the exec driver, check to ensure that you are running Nomad as root. This
    81  also applies for running Nomad in -dev mode.
    82  
    83  
    84  ## Client Attributes
    85  
    86  The `exec` driver will set the following client attributes:
    87  
    88  * `driver.exec` - This will be set to "1", indicating the
    89    driver is available.
    90  
    91  ## Resource Isolation
    92  
    93  The resource isolation provided varies by the operating system of
    94  the client and the configuration.
    95  
    96  On Linux, Nomad will use cgroups, and a chroot to isolate the
    97  resources of a process and as such the Nomad agent must be run as root.
    98  
    99  ### Chroot
   100  The chroot is populated with data in the following folders from the host
   101  machine:
   102  
   103  `["/bin", "/etc", "/lib", "/lib32", "/lib64", "/run/resolvconf", "/sbin",
   104  "/usr/bin", "/usr/lib", "/usr/sbin", "/usr/share"]`