github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/website/source/docs/drivers/raw_exec.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Drivers: Raw Exec"
     4  sidebar_current: "docs-drivers-raw-exec"
     5  description: |-
     6    The Raw Exec task driver simply fork/execs and provides no isolation.
     7  ---
     8  
     9  # Raw Fork/Exec Driver
    10  
    11  Name: `raw_exec`
    12  
    13  The `raw_exec` driver is used to execute a command for a task without any
    14  isolation. Further, the task is started as the same user as the Nomad process.
    15  As such, it should be used with extreme care and is disabled by default.
    16  
    17  ## Task Configuration
    18  
    19  ```hcl
    20  task "webservice" {
    21    driver = "raw_exec"
    22  
    23    config {
    24      command = "my-binary"
    25      args    = ["-flag", "1"]
    26    }
    27  }  
    28  ```
    29  
    30  The `raw_exec` driver supports the following configuration in the job spec:
    31  
    32  * `command` - The command to execute. Must be provided. If executing a binary
    33    that exists on the host, the path must be absolute. If executing a binary that
    34    is downloaded from an [`artifact`](/docs/job-specification/artifact.html), the
    35    path can be relative from the allocation's root directory.
    36  
    37  * `args` - (Optional) A list of arguments to the `command`. References
    38    to environment variables or any [interpretable Nomad
    39    variables](/docs/runtime/interpolation.html) will be interpreted before
    40    launching the task.
    41  
    42  ## Examples
    43  
    44  To run a binary present on the Node:
    45  
    46  ```
    47  task "example" {
    48    driver = "raw_exec"
    49  
    50    config {
    51      # When running a binary that exists on the host, the path must be absolute/
    52      command = "/bin/sleep"
    53      args    = ["1"]
    54    }
    55  }
    56  ```
    57  
    58  To execute a binary downloaded from an [`artifact`](/docs/job-specification/artifact.html):
    59  
    60  ```
    61  task "example" {
    62    driver = "raw_exec"
    63  
    64    config {
    65      command = "name-of-my-binary"
    66    }
    67  
    68    artifact {
    69      source = "https://internal.file.server/name-of-my-binary"
    70      options {
    71        checksum = "sha256:abd123445ds4555555555"
    72      }
    73    }
    74  }
    75  ```
    76  
    77  ## Client Requirements
    78  
    79  The `raw_exec` driver can run on all supported operating systems. For security
    80  reasons, it is disabled by default. To enable raw exec, the Nomad client
    81  configuration must explicitly enable the `raw_exec` driver in the plugin's options:
    82  
    83  ```
    84  plugin "raw_exec" {
    85    config {
    86      enabled = true
    87    }
    88  }
    89  ```
    90  
    91  Nomad versions before v0.9 use the following client configuration. This configuration is
    92  also supported in Nomad v0.9.0, but is deprecated in favor of the plugin stanza:
    93  
    94  ```
    95  client {
    96    options = {
    97      "driver.raw_exec.enable" = "1"
    98    }
    99  }
   100  ```
   101  
   102  ## Plugin Options
   103  
   104  * `enabled` - Specifies whether the driver should be enabled or disabled.
   105    Defaults to `false`.
   106  
   107  * `no_cgroups` - Specifies whether the driver should not use
   108    cgroups to manage the process group launched by the driver. By default,
   109    cgroups are used to manage the process tree to ensure full cleanup of all
   110    processes started by the task. The driver only uses cgroups when Nomad is
   111    launched as root, on Linux and when cgroups are detected.
   112  
   113  ## Client Options
   114  
   115  ~> Note: client configuration options will soon be deprecated. Please use 
   116  [plugin options][plugin-options] instead. See the [plugin stanza][plugin-stanza] documentation for more information.
   117  
   118  * `driver.raw_exec.enable` - Specifies whether the driver should be enabled or
   119    disabled. Defaults to `false`.
   120  
   121  * `driver.raw_exec.no_cgroups` - Specifies whether the driver should not use
   122    cgroups to manage the process group launched by the driver. By default,
   123    cgroups are used to manage the process tree to ensure full cleanup of all
   124    processes started by the task. The driver only uses cgroups when Nomad is
   125    launched as root, on Linux and when cgroups are detected.
   126  
   127  ## Client Attributes
   128  
   129  The `raw_exec` driver will set the following client attributes:
   130  
   131  * `driver.raw_exec` - This will be set to "1", indicating the driver is available.
   132  
   133  ## Resource Isolation
   134  
   135  The `raw_exec` driver provides no isolation.
   136  
   137  If the launched process creates a new process group, it is possible that Nomad
   138  will leak processes on shutdown unless the application forwards signals
   139  properly. Nomad will not leak any processes if cgroups are being used to manage
   140  the process tree. Cgroups are used on Linux when Nomad is being run with
   141  appropriate privileges, the cgroup system is mounted and the operator hasn't
   142  disabled cgroups for the driver.
   143  
   144  [plugin-options]: #plugin-options
   145  [plugin-stanza]: /docs/configuration/plugin.html