Packer
incus
@bketelsen
The incus plugin can be used with HashiCorp Packer to create OCI images with incus.
- Community
Updated 10 months ago
- GitHub(opens in new tab)
incus
Type: incus
Artifact BuilderId: incus
The incus
Packer builder builds containers for incus. The builder starts an incus
container, runs provisioners within this container, then saves the container as
an incus image.
The incus builder requires a modern linux kernel and the incus
package. This
builder does not work with LXC.
Basic Example
Below is a fully functioning example.
HCL
source "incus" "incus-xenial" {
image = "ubuntu-daily:xenial"
output_image = "ubuntu-xenial"
publish_properties {
description = "Trivial repackage with Packer"
}
}
build {
sources = ["incus.incus-xenial"]
}
JSON
{
"builders": [
{
"type": "incus",
"name": "incus-xenial",
"image": "ubuntu-daily:xenial",
"output_image": "ubuntu-xenial",
"publish_properties": {
"description": "Trivial repackage with Packer"
}
}
]
}
Configuration Reference
Required:
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, ...
~> Note: The builder may appear to pause if required to download a
remote image, as they are usually 100-200MB. /var/log/incus/incus.log
will
mention starting such downloads.
Optional:
output_image
(string) - The name of the output artifact. Defaults to name.reuse
(bool) - Reuse image alias if it already exists; defaults to falsecontainer_name
(string) - Container Namepublish_remote_name
(string) - The (optional) name of the incus remote on which to publish the container image.command_wrapper
(string) - Lets you prefix all builder commands, such as with ssh for a remote build host. Defaults to{{.Command}}
; i.e. no wrapper.profile
(string) - Profileinit_sleep
(string) - The number of seconds to sleep between launching the incus instance and provisioning it; defaults to 3 seconds.publish_properties
(map[string]string) - Pass key values to the publish 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/incus-2-0-image-management-512/ for more properties.launch_config
(map[string]string) - List of key/value pairs you wish to pass to lxc launch via --config. Defaults to empty.virtual_machine
(bool) - Create incus virtual-machine image on hosts running incus 4.0 and above; defaults to false for container imageskip_publish
(bool) - Skip executelxc publish
; defaults to false