github.com/smintz/nomad@v0.8.3/website/source/docs/drivers/lxc.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Drivers: LXC"
     4  sidebar_current: "docs-drivers-lxc"
     5  description: |-
     6    The LXC task driver is used to run application containers using LXC.
     7  ---
     8  
     9  # LXC Driver
    10  
    11  Name: `lxc`
    12  
    13  The `lxc` driver provides an interface for using LXC for running application
    14  containers.
    15  
    16  !> **Experimental!** Currently, the LXC driver supports launching containers
    17  via templates but only supports host networking. If both an LXC image and the
    18  host it is run on use upstart or systemd, shutdown signals may be passed from
    19  the container to the host.
    20  
    21  ~> LXC is only enabled in the special `linux_amd64_lxc` build of Nomad because
    22  it links to the `liblxc` system library. Use the `lxc` build tag if compiling
    23  Nomad yourself.
    24  
    25  ## Task Configuration
    26  
    27  ```hcl
    28  task "busybox" {
    29    driver = "lxc"
    30  
    31    config {
    32      log_level = "trace"
    33      verbosity = "verbose"
    34      template = "/usr/share/lxc/templates/lxc-busybox"
    35    }
    36  }
    37  ```
    38  
    39  The `lxc` driver supports the following configuration in the job spec:
    40  
    41  * `template` - The LXC template to run.
    42  
    43      ```hcl
    44      config {
    45        template = "/usr/share/lxc/templates/lxc-alpine"
    46      }
    47      ```
    48  
    49  * `log_level` - (Optional) LXC library's logging level. Defaults to `error`.
    50    Must be one of `trace`, `debug`, `info`, `warn`, or `error`.
    51  
    52      ```hcl
    53      config {
    54        log_level = "debug"
    55      }
    56      ```
    57  
    58  * `verbosity` - (Optional) Enables extra verbosity in the LXC library's
    59    logging. Defaults to `quiet`. Must be one of `quiet` or `verbose`.
    60  
    61      ```hcl
    62      config {
    63        verbosity = "quiet"
    64      }
    65      ```
    66  
    67  * `volumes` - (Optional) A list of `host_path:container_path` strings to bind-mount
    68    host paths to container paths. Mounting host paths outside of the allocation
    69    directory can be disabled on clients by setting the `lxc.volumes.enabled`
    70    option set to false. This will limit volumes to directories that exist inside
    71    the allocation directory.
    72  
    73    Note that unlike the similar option for the docker driver, this
    74    option must not have an absolute path as the `container_path`
    75    component. This will cause an error when submitting a job.
    76  
    77    Setting this does not affect the standard bind-mounts of `alloc`,
    78    `local`, and `secrets`, which are always created.
    79  
    80      ```hcl
    81      config {
    82        volumes = [
    83          # Use absolute paths to mount arbitrary paths on the host
    84          "/path/on/host:path/in/container",
    85  
    86          # Use relative paths to rebind paths already in the allocation dir
    87          "relative/to/task:also/in/container"
    88        ]
    89      }
    90      ```
    91  
    92  ## Networking
    93  
    94  Currently the `lxc` driver only supports host networking. See the `none`
    95  networking type in the [`lxc.container.conf` manual][lxc_man] for more
    96  information.
    97  
    98  [lxc_man]: https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html#lbAM
    99  
   100  ## Client Requirements
   101  
   102  The `lxc` driver requires the following:
   103  
   104  * 64-bit Linux host
   105  * The `linux_amd64_lxc` Nomad binary
   106  * `liblxc` to be installed
   107  * `lxc-templates` to be installed
   108  
   109  ## Client Configuration
   110  
   111  * `lxc.enable` - The `lxc` driver may be disabled on hosts by setting this
   112    [client configuration][/docs/agent/configuration/client.html##options-parameters]
   113    option to `false` (defaults to `true`).
   114  
   115  ## Client Attributes
   116  
   117  The `lxc` driver will set the following client attributes:
   118  
   119  * `driver.lxc` - Set to `1` if LXC is found  and enabled on the host node.
   120  * `driver.lxc.version` - Version of `lxc` e.g.: `1.1.0`.
   121  
   122  ## Resource Isolation
   123  
   124  This driver supports CPU and memory isolation via the `lxc` library. Network
   125  isolation is not supported as of now.