github.com/huiliang/nomad@v0.2.1-0.20151124023127-7a8b664699ff/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 `command`. 36 37 ## Client Requirements 38 39 The `exec` driver can only be run when on Linux and running Nomad as root. 40 `exec` is limited to this configuration because currently isolation of resources 41 is only guaranteed on Linux. Further the host must have cgroups mounted properly 42 in order for the driver to work. 43 44 You must specify a `command` to be executed. Optionally you can specify an 45 `artifact_source` to be downloaded as well. Any `command` is assumed to be present on the 46 running client, or a downloaded artifact. 47 48 ## Examples 49 50 To run a binary present on the Node: 51 52 ``` 53 config { 54 command = "/bin/sleep" 55 args = 1 56 } 57 ``` 58 59 To execute a binary specified by `artifact_source`: 60 61 ``` 62 config { 63 artifact_source = "https://dl.dropboxusercontent.com/u/1234/binary.bin" 64 checksum = "sha256:abd123445ds4555555555" 65 command = "$NOMAD_TASK_DIR/binary.bin" 66 } 67 ``` 68 69 ## Client Attributes 70 71 The `exec` driver will set the following client attributes: 72 73 * `driver.exec` - This will be set to "1", indicating the 74 driver is available. 75 76 ## Resource Isolation 77 78 The resource isolation provided varies by the operating system of 79 the client and the configuration. 80 81 On Linux, Nomad will use cgroups, and a chroot to isolate the 82 resources of a process and as such the Nomad agent must be run as root.