github.com/ranjib/nomad@v0.1.1-0.20160225204057-97751b02f70b/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.
    24  
    25  * `artifact_source` – (Optional) Source location of an executable artifact. Must
    26    be accessible from the Nomad client. If you specify an `artifact_source` to be
    27    executed, you must reference it in the `command` as show in the examples below
    28  
    29  * `checksum` - (Optional) The checksum type and value for the `artifact_source`
    30    image.  The format is `type:value`, where type is any of `md5`, `sha1`,
    31    `sha256`, or `sha512`, and the value is the computed checksum. If a checksum
    32    is supplied and does not match the downloaded artifact, the driver will fail
    33    to start
    34  
    35  *   `args` - (Optional) A list of arguments to the optional `command`.
    36      References to environment variables or any [intepretable Nomad
    37      variables](/docs/jobspec/interpreted.html) will be interpreted
    38      before launching the task. For example:
    39  
    40      ```
    41          args = ["${nomad.datacenter}", "${MY_ENV}", "${meta.foo}"]
    42      ```
    43  
    44  ## Client Requirements
    45  
    46  The `exec` driver can only be run when on Linux and running Nomad as root.
    47  `exec` is limited to this configuration because currently isolation of resources
    48  is only guaranteed on Linux. Further the host must have cgroups mounted properly
    49  in order for the driver to work.
    50  
    51  You must specify a `command` to be executed. Optionally you can specify an
    52  `artifact_source` to be downloaded as well. Any `command` is assumed to be present on the 
    53  running client, or a downloaded artifact.
    54  
    55  ## Examples
    56  
    57  To run a binary present on the Node:
    58  
    59  ```
    60    config {
    61      command = "/bin/sleep"
    62      args = 1
    63    }
    64  ```
    65  
    66  To execute a binary specified by `artifact_source`:
    67  
    68  ```
    69    config {
    70      artifact_source = "https://dl.dropboxusercontent.com/u/1234/binary.bin"
    71      checksum = "sha256:abd123445ds4555555555"
    72      command = "binary.bin"
    73    }
    74  ```
    75  
    76  ## Client Attributes
    77  
    78  The `exec` driver will set the following client attributes:
    79  
    80  * `driver.exec` - This will be set to "1", indicating the
    81    driver is available.
    82  
    83  ## Resource Isolation
    84  
    85  The resource isolation provided varies by the operating system of
    86  the client and the configuration.
    87  
    88  On Linux, Nomad will use cgroups, and a chroot to isolate the
    89  resources of a process and as such the Nomad agent must be run as root.
    90  
    91  ### Chroot
    92  The chroot is populated with data in the following folders from the host
    93  machine:
    94  
    95  `["/bin", "/etc", "/lib", "/lib32", "/lib64", "/usr/bin", "/usr/lib", "/usr/share"]`