open-nomad/website/content/docs/drivers/raw_exec.mdx

133 lines
3.7 KiB
Plaintext
Raw Normal View History

2015-10-08 19:18:44 +00:00
---
2020-02-06 23:45:31 +00:00
layout: docs
page_title: 'Drivers: Raw Exec'
description: The Raw Exec task driver simply fork/execs and provides no isolation.
2015-10-08 19:18:44 +00:00
---
# Raw Fork/Exec Driver
Name: `raw_exec`
The `raw_exec` driver is used to execute a command for a task without any
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
```hcl
task "webservice" {
driver = "raw_exec"
config {
command = "my-binary"
args = ["-flag", "1"]
}
2020-02-06 23:45:31 +00:00
}
```
2015-10-08 19:18:44 +00:00
The `raw_exec` driver supports the following configuration in the job spec:
2020-02-06 23:45:31 +00:00
- `command` - The command to execute. Must be provided. If executing a binary
2016-03-16 16:56:04 +00:00
that exists on the host, the path must be absolute. If executing a binary that
2020-02-06 23:45:31 +00:00
is downloaded from an [`artifact`](/docs/job-specification/artifact), the
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
path can be relative from the allocation's root directory.
2020-02-06 23:45:31 +00:00
- `args` - (Optional) A list of arguments to the `command`. References
to environment variables or any [interpretable Nomad
2020-02-06 23:45:31 +00:00
variables](/docs/runtime/interpolation) will be interpreted before
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
```
task "example" {
driver = "raw_exec"
2016-03-16 16:56:04 +00:00
config {
# When running a binary that exists on the host, the path must be absolute/
command = "/bin/sleep"
args = ["1"]
}
}
2015-10-08 19:18:44 +00:00
```
2020-02-06 23:45:31 +00:00
To execute a binary downloaded from an [`artifact`](/docs/job-specification/artifact):
2016-03-16 16:56:04 +00:00
```
task "example" {
driver = "raw_exec"
config {
command = "name-of-my-binary"
}
artifact {
source = "https://internal.file.server/name-of-my-binary"
options {
checksum = "sha256:abd123445ds4555555555"
2016-03-16 16:56:04 +00:00
}
}
}
```
## Capabilities
The `raw_exec` driver implements the following [capabilities](/docs/internals/plugins/task-drivers#capabilities-capabilities-error).
2020-09-30 13:48:40 +00:00
| Feature | Implementation |
| -------------------- | -------------- |
| `nomad alloc signal` | true |
| `nomad alloc exec` | true |
| filesystem isolation | none |
| network isolation | host, group |
| volume mounting | none |
2016-03-16 16:56:04 +00:00
## Client Requirements
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
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
configuration must explicitly enable the `raw_exec` driver in the plugin's options:
```
plugin "raw_exec" {
config {
enabled = true
}
}
```
## Plugin Options
2020-02-06 23:45:31 +00:00
- `enabled` - Specifies whether the driver should be enabled or disabled.
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
Defaults to `false`.
2020-02-06 23:45:31 +00:00
- `no_cgroups` - Specifies whether the driver should not use
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
cgroups to manage the process group launched by the driver. By default,
cgroups are used to manage the process tree to ensure full cleanup of all
2019-07-24 15:57:52 +00:00
processes started by the task. The driver uses cgroups by default on
Linux and when `/sys/fs/cgroup/freezer/nomad` is writable for the
Nomad process. Using a cgroup significantly reduces Nomad's CPU
usage when collecting process metrics.
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
2015-10-08 19:18:44 +00:00
## Client Attributes
The `raw_exec` driver will set the following client attributes:
2020-02-06 23:45:31 +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.
2018-05-31 18:09:00 +00:00
If the launched process creates a new process group, it is possible that Nomad
will leak processes on shutdown unless the application forwards signals
properly. Nomad will not leak any processes if cgroups are being used to manage
the process tree. Cgroups are used on Linux when Nomad is being run with
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
appropriate privileges, the cgroup system is mounted and the operator hasn't
2018-05-31 18:09:00 +00:00
disabled cgroups for the driver.
add plugin content (docs) (#5186) * call out pluggable drivers in task drivers section and link/add info to plugin stanza * fix hyphenation * removing page and nav that tells users drivers are not pluggable * show new syntax for configuring raw_exec plugin on client * enabled option value for raw_exec is boolean * add plugin options section and mark client options as soon to be deprecated * fix typos * add plugin options for rkt task drivers and place deprecation warning in client options * add some plugin options with plugin configuration example + mark client options as soon to be deprecated * modify deprecation warning * replace colon with - for options * add docker plugin options * update links within docker task driver to point to plugin options * fix typo and clarify config options for lxc task driver * replace raw_exec plugin syntax example with docker example * create external section * restructure lxc docs and add backward incompatibility warning * update lxc driver doc * add redirect for lxc driver doc * call out plugin options and mark client config options for drivers as deprecated * add placeholder for lxc driver binary download * update data_dir/plugins reference with plugin_dir reference * Update website/source/docs/external/lxc.html.md Co-Authored-By: Omar-Khawaja <Omar-Khawaja@users.noreply.github.com> * corrections * remove lxc from built-in drivers navigation * reorganize doc structure and fix redirect * add detail about 0.9 changes * implement suggestions/fixes * removed extraneous punctuation * add official lxc driver link
2019-01-29 20:53:05 +00:00
[plugin-options]: #plugin-options
2020-02-06 23:45:31 +00:00
[plugin-stanza]: /docs/configuration/plugin