github.com/anuvu/nomad@v0.8.7-atom1/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 allocations'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 client's
    82  [options](/docs/agent/configuration/client.html#options):
    83  
    84  ```
    85  client {
    86    options = {
    87      "driver.raw_exec.enable" = "1"
    88    }
    89  }
    90  ```
    91  
    92  ## Client Options
    93  
    94  * `driver.raw_exec.enable` - Specifies whether the driver should be enabled or
    95    disabled.
    96  
    97  * `driver.raw_exec.no_cgroups` - Specifies whether the driver should not use
    98    cgroups to manage the process group launched by the driver. By default,
    99    cgroups are used to manage the process tree to ensure full cleanup of all
   100    processes started by the task. The driver only uses cgroups when Nomad is
   101    launched as root, on Linux and when cgroups are detected.
   102  
   103  ## Client Attributes
   104  
   105  The `raw_exec` driver will set the following client attributes:
   106  
   107  * `driver.raw_exec` - This will be set to "1", indicating the driver is available.
   108  
   109  ## Resource Isolation
   110  
   111  The `raw_exec` driver provides no isolation.
   112  
   113  If the launched process creates a new process group, it is possible that Nomad
   114  will leak processes on shutdown unless the application forwards signals
   115  properly. Nomad will not leak any processes if cgroups are being used to manage
   116  the process tree. Cgroups are used on Linux when Nomad is being run with
   117  appropriate priviledges, the cgroup system is mounted and the operator hasn't
   118  disabled cgroups for the driver.