77 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2016-07-01 06:45:48 +00:00
---
description: |
The `lxd` Packer builder builds containers for LXD. The builder starts an LXD
container, runs provisioners within this container, then saves the container
as an LXD image.
layout: docs
2017-09-12 15:45:55 -07:00
page_title: 'LXD - Builders'
sidebar_current: 'docs-builders-lxd'
2016-07-01 06:45:48 +00:00
...
# LXD Builder
Type: `lxd`
The `lxd` Packer builder builds containers for LXD. The builder starts an LXD
container, runs provisioners within this container, then saves the container
as an LXD image.
The LXD builder requires a modern linux kernel and the `lxd` package.
This builder does not work with LXC.
## Basic Example
2017-09-12 15:45:55 -07:00
Below is a fully functioning example.
2016-07-01 06:45:48 +00:00
``` {.javascript}
{
"builders": [
{
"type": "lxd",
"name": "lxd-xenial",
"image": "ubuntu-daily:xenial",
"output_image": "ubuntu-xenial",
2017-10-18 05:05:46 +00:00
"publish_properties": {
"description": "Trivial repackage with Packer"
}
2016-07-01 06:45:48 +00:00
}
]
}
```
2017-10-18 05:05:46 +00:00
2016-07-01 06:45:48 +00:00
## Configuration Reference
### Required:
2017-09-12 15:45:55 -07:00
- `image` (string) - The source image to use when creating the build
container. This can be a (local or remote) image (name or fingerprint). E.G.
`my-base-image,` `ubuntu-daily:x,` `08fababf6f27`, ...
2016-07-01 06:45:48 +00:00
2017-09-12 15:45:55 -07:00
~> Note: The builder may appear to pause if required to download
a remote image, as they are usually 100-200MB. `/var/log/lxd/lxd.log` will
mention starting such downloads.
2016-07-01 06:45:48 +00:00
2017-09-12 15:45:55 -07:00
### Optional:
2016-07-01 06:45:48 +00:00
2018-03-23 15:46:39 -07:00
- `init_sleep` (string) - The number of seconds to sleep between launching the
LXD instance and provisioning it; defaults to 3 seconds.
2017-09-12 15:45:55 -07:00
- `name` (string) - The name of the started container. Defaults to
`packer-$PACKER_BUILD_NAME`.
2017-09-12 15:45:55 -07:00
- `output_image` (string) - The name of the output artifact. Defaults to
`name`.
2016-07-01 06:45:48 +00:00
2017-10-18 05:05:46 +00:00
- `command_wrapper` (string) - Lets you prefix all builder commands, such as
2017-09-12 15:45:55 -07:00
with `ssh` for a remote build host. Defaults to `""`.
2017-10-18 05:05:46 +00:00
2018-08-02 20:05:42 +00:00
- `publish_properties` (map[string]string) - Pass key values to the publish
2017-10-18 05:05:46 +00:00
step to be set as properties on the output image. This is most helpful to
set the description, but can be used to set anything needed.
See https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/
for more properties.
2018-08-02 20:05:42 +00:00
- `launch_config` (map[string]string) - List of key/value pairs you wish to
pass to `lxc launch` via `--config`. Defaults to empty.