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

     1  ---
     2  layout: "docs"
     3  page_title: "Drivers: Rkt"
     4  sidebar_current: "docs-drivers-rkt"
     5  description: |-
     6    The rkt task driver is used to run application containers using rkt.
     7  ---
     8  
     9  # Rkt Driver
    10  
    11  Name: `rkt`
    12  
    13  The `rkt` driver provides an interface for using rkt for running
    14  application containers.
    15  
    16  ## Task Configuration
    17  
    18  ```hcl
    19  task "webservice" {
    20    driver = "rkt"
    21  
    22    config {
    23      image = "redis:3.2"
    24    }
    25  }
    26  ```
    27  
    28  The `rkt` driver supports the following configuration in the job spec:
    29  
    30  * `image` - The image to run. May be specified by name, hash, ACI address
    31    or docker registry.
    32  
    33      ```hcl
    34      config {
    35        image = "https://hub.docker.internal/redis:3.2"
    36      }
    37      ```
    38  
    39  * `command` - (Optional) A command to execute on the ACI.
    40  
    41      ```hcl
    42      config {
    43        command = "my-command"
    44      }
    45      ```
    46  
    47  * `args` - (Optional) A list of arguments to the optional `command`. References
    48    to environment variables or any [interpretable Nomad
    49    variables](/docs/runtime/interpolation.html) will be interpreted before
    50    launching the task.
    51  
    52      ```hcl
    53      config {
    54        args = [
    55          "-bind", "${NOMAD_PORT_http}",
    56          "${nomad.datacenter}",
    57          "${MY_ENV}",
    58          "${meta.foo}",
    59        ]
    60      }
    61      ```
    62  
    63  * `trust_prefix` - (Optional) The trust prefix to be passed to rkt. Must be
    64    reachable from the box running the nomad agent. If not specified, the image is
    65    run with `--insecure-options=all`.
    66  
    67  * `insecure_options` - (Optional) List of insecure options for rkt. Consult `rkt --help`
    68    for list of supported values. This list overrides the `--insecure-options=all` default when
    69    no ```trust_prefix``` is provided in the job config, which can be effectively used to enforce
    70    secure runs, using ```insecure_options = ["none"]``` option.
    71  
    72    ```hcl
    73    config {
    74        image = "example.com/image:1.0"
    75        insecure_options = ["image", "tls", "ondisk"]
    76    }
    77    ```
    78  
    79  * `dns_servers` - (Optional) A list of DNS servers to be used in the container.
    80    Alternatively a list containing just `host` or `none`. `host` uses the host's
    81    `resolv.conf` while `none` forces use of the image's name resolution configuration.
    82  
    83  * `dns_search_domains` - (Optional) A list of DNS search domains to be used in
    84     the containers.
    85  
    86  * `net` - (Optional) A list of networks to be used by the containers
    87  
    88  * `port_map` - (Optional) A key/value map of ports used by the container. The
    89     value is the port name specified in the image manifest file.  When running
    90     Docker images with rkt the port names will be of the form `${PORT}-tcp`. See
    91     [networking](#networking) below for more details.
    92  
    93     ```hcl
    94      port_map {
    95              # If running a Docker image that exposes port 8080
    96              app = "8080-tcp"
    97      }
    98     ```
    99     
   100  
   101  * `debug` - (Optional) Enable rkt command debug option.
   102  
   103  * `no_overlay` - (Optional) When enabled, will use `--no-overlay=true` flag for 'rkt run'.
   104    Useful when running jobs on older systems affected by https://github.com/rkt/rkt/issues/1922
   105  
   106  * `volumes` - (Optional) A list of `host_path:container_path[:readOnly]` strings to bind
   107    host paths to container paths.
   108    Mount is done read-write by default; an optional third parameter `readOnly` can be provided
   109    to make it read-only.
   110  
   111      ```hcl
   112      config {
   113        volumes = ["/path/on/host:/path/in/container", "/readonly/path/on/host:/path/in/container:readOnly"]
   114      }
   115      ```
   116  
   117  * `group` - (Optional) Specifies the group that will run the task. Sets the
   118    `--group` flag and overrides the group specified by the image. The
   119    [`user`][user] may be specified at the task level.
   120  
   121  ## Networking
   122  
   123  The `rkt` can specify `--net` and `--port` for the rkt client. Hence, there are two ways to use host ports by
   124  using `--net=host` or `--port=PORT` with your network.
   125  
   126  Example:
   127  
   128  ```
   129  task "redis" {
   130  	# Use rkt to run the task.
   131  	driver = "rkt"
   132  
   133  	config {
   134  		# Use docker image with port defined
   135  		image = "docker://redis:latest"
   136  		port_map {
   137  			app = "6379-tcp"
   138  		}
   139  	}
   140  
   141  	service {
   142  		port = "app"
   143  	}
   144  
   145  	resources {
   146  		network {
   147  			mbits = 10
   148  			port "app" {
   149  			    static = 12345
   150  			}
   151  		}
   152  	}
   153  }
   154  ```
   155  
   156  ### Allocating Ports
   157  
   158  You can allocate ports to your task using the port syntax described on the
   159  [networking page](/docs/job-specification/network.html).
   160  
   161  When you use port allocation, the image manifest needs to declare public ports and host has configured network.
   162  For more information, please refer to [rkt Networking](https://coreos.com/rkt/docs/latest/networking/overview.html).
   163  
   164  ## Client Requirements
   165  
   166  The `rkt` driver requires the following:
   167  * The Nomad client agent to be running as the root user.
   168  * rkt to be installed and in your system's `$PATH`.
   169  * The `trust_prefix` must be accessible by the node running Nomad. This can be an
   170  internal source, private to your cluster, but it must be reachable by the client
   171  over HTTP.
   172  
   173  ## Plugin Options
   174  
   175  * `volumes_enabled` - Defaults to `true`. Allows tasks to bind host paths
   176    (`volumes`) inside their container. Binding relative paths is always allowed
   177    and will be resolved relative to the allocation's directory. 
   178  
   179  ## Client Configuration
   180  
   181  ~> Note: client configuration options will soon be deprecated. Please use [plugin options][plugin-options] instead. See the [plugin stanza][plugin-stanza] documentation for more information.
   182  
   183  The `rkt` driver has the following [client configuration
   184  options](/docs/configuration/client.html#options):
   185  
   186  * `rkt.volumes.enabled` - Defaults to `true`. Allows tasks to bind host paths
   187    (`volumes`) inside their container. Binding relative paths is always allowed
   188    and will be resolved relative to the allocation's directory.
   189  
   190  
   191  ## Client Attributes
   192  
   193  The `rkt` driver will set the following client attributes:
   194  
   195  * `driver.rkt` - Set to `1` if rkt is found on the host node. Nomad determines
   196    this by executing `rkt version` on the host and parsing the output
   197  * `driver.rkt.version` - Version of `rkt` e.g.: `1.27.0`. Note that the minimum required
   198    version is `1.27.0`
   199  * `driver.rkt.appc.version` - Version of `appc` that `rkt` is using e.g.: `1.1.0`
   200  
   201  Here is an example of using these properties in a job file:
   202  
   203  ```hcl
   204  job "docs" {
   205    # Only run this job where the rkt version is higher than 0.8.
   206    constraint {
   207      attribute = "${driver.rkt.version}"
   208      operator  = ">"
   209      value     = "1.2"
   210    }
   211  }
   212  ```
   213  
   214  ## Resource Isolation
   215  
   216  This driver supports CPU and memory isolation by delegating to `rkt`. Network
   217  isolation is not supported as of now.
   218  
   219  
   220  [user]: /docs/job-specification/task.html#user
   221  [plugin-options]: #plugin-options
   222  [plugin-stanza]: /docs/configuration/plugin.html