Image Description
KIWI builds images from a description directory. The directory describes what packages to install, how to configure the target system, and which image types should be created from the prepared root tree.
Description Directory Layout
A description directory usually contains these files:
config.xmlor*.kiwiThe main image description. It defines metadata, repositories, packages, users, image types, and optional profile-specific variants.
root/orroot.tar.gzOverlay content copied into the prepared root tree after package installation.
config.shAn optional shell hook executed near the end of the prepare step.
images.shAn optional shell hook executed at the beginning of the create step.
config-cdroot.tar[.*]Optional additional files for ISO-style images, such as licenses or offline documentation.
- Referenced archives, drivers, certificate files, and include files
Additional resources referenced from the image description itself.
Minimal Example
The following description is enough to prepare a root tree and create a simple image from it:
<image schemaversion="8.5" name="example">
<description type="system">
<author>Example Author</author>
<contact>example@example.invalid</contact>
<specification>Small example image</specification>
</description>
<preferences>
<version>1.0.0</version>
<packagemanager>zypper</packagemanager>
<type image="oem" filesystem="ext4"/>
</preferences>
<repository type="rpm-md">
<source path="https://download.opensuse.org/distribution/leap/16.0/repo/oss"/>
</repository>
<packages type="image">
<package name="bash"/>
</packages>
</image>
Top-Level Schema Layout
The kiwi/schema/kiwi.rnc schema organizes the document below the
<image> root element in this order:
Section |
Purpose |
Main attributes and children |
Reference |
|---|---|---|---|
|
Root node of the description. |
Required: |
|
|
Insert the inner content of another XML description file. |
|
|
|
Import additional CA certificates during the build. |
|
|
|
Define human-readable identity and ownership. |
|
|
|
Define versions, package manager behavior, and one or more image types. |
Optional |
|
|
Group conditional variants of the same description. |
|
|
|
Create or adjust users and groups in the image. |
User records, group membership, home, shell, SSH keys, and password data. |
|
|
Add driver files to the image description. |
File references with optional profile filters. |
|
|
Remove files, libraries, or toolchains from the prepared root tree. |
Optional |
|
|
Point KIWI to package sources. |
Repository type, source type, priority, GPG behavior, credentials, and source URLs. |
|
|
Define container registry sources used by container-based builds. |
One or more registry definitions and registry-specific credentials. |
|
|
Define what KIWI installs, deletes, or imports. |
|
|
|
Attach custom XML namespaces validated outside the built-in schema. |
Arbitrary namespaced content. |
What to Configure First
When you create or review an image description, work in this order:
Start with <description> so the image has clear ownership and a purpose.
Add at least one <preferences> block with a version, package manager, and one or more type definitions.
Add the <repository> entries that provide the packages needed for the build.
Add one or more <packages> sections to populate the root tree.
Add optional sections such as <users>, <profiles>, or <certificates> only when the use case needs them.
Common Patterns
Use profiles when one description should build multiple variants.
<profiles>
<profile name="VMX" description="VMware output"/>
<profile name="CLOUD" description="Cloud output"/>
</profiles>
<preferences profiles="VMX">
<version>1.0.0</version>
<packagemanager>zypper</packagemanager>
<type image="oem" format="vmdk" filesystem="ext4"/>
</preferences>
<preferences profiles="CLOUD">
<version>1.0.0</version>
<packagemanager>zypper</packagemanager>
<type image="oem" format="qcow2" filesystem="ext4"/>
</preferences>
Use multiple package sections to separate bootstrap packages from the final image content.
<packages type="bootstrap">
<package name="filesystem"/>
<package name="glibc-locale"/>
</packages>
<packages type="image">
<package name="bash"/>
<package name="vim"/>
</packages>
Complete Schema Reference
The exhaustive element and attribute reference is documented in
Schema Reference. That reference follows the schema in
kiwi/schema/kiwi.rnc and covers:
every top-level section allowed below
<image>;all common and type-specific attributes of
<preferences><type>;repository, package, user, profile, bootloader, storage, and container substructures; and
examples for the most frequently used sections.
Use this page as the guide to the structure of a description directory and use Schema Reference as the schema-backed lookup for every valid section and attribute.