2015-10-08 19:18:44 +00:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Drivers: Raw Exec"
|
|
|
|
sidebar_current: "docs-drivers-raw-exec"
|
|
|
|
description: |-
|
|
|
|
The Raw Exec task driver simply fork/execs and provides no isolation.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Raw Fork/Exec Driver
|
|
|
|
|
|
|
|
Name: `raw_exec`
|
|
|
|
|
|
|
|
The `raw_exec` driver is used to execute a command for a task without any
|
2015-10-09 18:29:59 +00:00
|
|
|
isolation. Further, the task is started as the same user as the Nomad process.
|
|
|
|
As such, it should be used with extreme care and is disabled by default.
|
2015-10-08 19:18:44 +00:00
|
|
|
|
|
|
|
## Task Configuration
|
|
|
|
|
2016-10-03 21:35:20 +00:00
|
|
|
```hcl
|
|
|
|
task "webservice" {
|
|
|
|
driver = "raw_exec"
|
|
|
|
|
|
|
|
config {
|
|
|
|
command = "my-binary"
|
|
|
|
args = ["-flag", "1"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-10-08 19:18:44 +00:00
|
|
|
The `raw_exec` driver supports the following configuration in the job spec:
|
|
|
|
|
2016-03-16 16:56:04 +00:00
|
|
|
* `command` - The command to execute. Must be provided. If executing a binary
|
|
|
|
that exists on the host, the path must be absolute. If executing a binary that
|
2016-10-28 00:36:26 +00:00
|
|
|
is downloaded from an [`artifact`](/docs/job-specification/artifact.html), the
|
2016-03-16 16:56:04 +00:00
|
|
|
path can be relative from the allocations's root directory.
|
2015-11-18 23:16:42 +00:00
|
|
|
|
2016-10-11 19:52:50 +00:00
|
|
|
* `args` - (Optional) A list of arguments to the `command`. References
|
2016-10-03 21:35:20 +00:00
|
|
|
to environment variables or any [interpretable Nomad
|
2016-10-28 00:36:26 +00:00
|
|
|
variables](/docs/runtime/interpolation.html) will be interpreted before
|
2016-10-11 19:52:50 +00:00
|
|
|
launching the task.
|
2015-10-08 19:18:44 +00:00
|
|
|
|
2016-03-16 16:56:04 +00:00
|
|
|
## Examples
|
2015-10-08 19:18:44 +00:00
|
|
|
|
2016-03-16 16:56:04 +00:00
|
|
|
To run a binary present on the Node:
|
2015-10-08 19:18:44 +00:00
|
|
|
|
|
|
|
```
|
2016-10-03 21:35:20 +00:00
|
|
|
task "example" {
|
|
|
|
driver = "raw_exec"
|
2016-03-16 16:56:04 +00:00
|
|
|
|
2016-10-03 21:35:20 +00:00
|
|
|
config {
|
|
|
|
# When running a binary that exists on the host, the path must be absolute/
|
|
|
|
command = "/bin/sleep"
|
|
|
|
args = ["1"]
|
2015-11-21 20:18:16 +00:00
|
|
|
}
|
2016-10-03 21:35:20 +00:00
|
|
|
}
|
2015-10-08 19:18:44 +00:00
|
|
|
```
|
|
|
|
|
2016-10-28 00:36:26 +00:00
|
|
|
To execute a binary downloaded from an [`artifact`](/docs/job-specification/artifact.html):
|
2015-10-15 21:40:08 +00:00
|
|
|
|
2016-03-16 16:56:04 +00:00
|
|
|
```
|
2016-10-03 21:35:20 +00:00
|
|
|
task "example" {
|
|
|
|
driver = "raw_exec"
|
2015-10-15 21:40:08 +00:00
|
|
|
|
2016-10-03 21:35:20 +00:00
|
|
|
config {
|
|
|
|
command = "name-of-my-binary"
|
|
|
|
}
|
2015-10-15 21:40:08 +00:00
|
|
|
|
2016-10-03 21:35:20 +00:00
|
|
|
artifact {
|
|
|
|
source = "https://internal.file.server/name-of-my-binary"
|
|
|
|
options {
|
|
|
|
checksum = "sha256:abd123445ds4555555555"
|
2016-03-16 16:56:04 +00:00
|
|
|
}
|
2015-10-15 21:40:08 +00:00
|
|
|
}
|
2016-10-03 21:35:20 +00:00
|
|
|
}
|
2015-10-15 21:40:08 +00:00
|
|
|
```
|
|
|
|
|
2016-03-16 16:56:04 +00:00
|
|
|
## Client Requirements
|
|
|
|
|
2016-10-03 21:35:20 +00:00
|
|
|
The `raw_exec` driver can run on all supported operating systems. For security
|
|
|
|
reasons, it is disabled by default. To enable raw exec, the Nomad client
|
|
|
|
configuration must explicitly enable the `raw_exec` driver in the client's
|
2016-11-01 12:53:13 +00:00
|
|
|
[options](/docs/agent/configuration/client.html#options):
|
2015-10-15 21:40:08 +00:00
|
|
|
|
|
|
|
```
|
2016-10-03 21:35:20 +00:00
|
|
|
client {
|
|
|
|
options = {
|
|
|
|
"driver.raw_exec.enable" = "1"
|
|
|
|
}
|
|
|
|
}
|
2015-10-15 21:40:08 +00:00
|
|
|
```
|
|
|
|
|
2015-10-08 19:18:44 +00:00
|
|
|
## Client Attributes
|
|
|
|
|
|
|
|
The `raw_exec` driver will set the following client attributes:
|
|
|
|
|
2016-10-03 21:00:32 +00:00
|
|
|
* `driver.raw_exec` - This will be set to "1", indicating the driver is available.
|
|
|
|
|
2015-10-08 19:18:44 +00:00
|
|
|
## Resource Isolation
|
|
|
|
|
|
|
|
The `raw_exec` driver provides no isolation.
|