.. _image-description:
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.
.. contents:: On this page
:local:
:depth: 2
Description Directory Layout
----------------------------
A description directory usually contains these files:
:file:`config.xml` or :file:`*.kiwi`
The main image description. It defines metadata, repositories, packages,
users, image types, and optional profile-specific variants.
:file:`root/` or :file:`root.tar.gz`
Overlay content copied into the prepared root tree after package
installation.
:file:`config.sh`
An optional shell hook executed near the end of the prepare step.
:file:`images.sh`
An optional shell hook executed at the beginning of the create step.
:file:`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:
.. code:: xml
Example Authorexample@example.invalidSmall example image1.0.0zypper
Top-Level Schema Layout
-----------------------
The :file:`kiwi/schema/kiwi.rnc` schema organizes the document below the
:ref:`sec.image` root element in this order:
.. list-table:: Top-level sections
:widths: 18 34 32 16
:header-rows: 1
* - Section
- Purpose
- Main attributes and children
- Reference
* - ````
- Root node of the description.
- Required: ``name``, ``schemaversion``. Optional: ``displayname``, ``id``.
- :ref:`sec.image`
* - ````
- Insert the inner content of another XML description file.
- ``from`` URI attribute.
- :ref:`sec.include`
* - ````
- Import additional CA certificates during the build.
- ``target_distribution`` with one or more ```` entries.
- :ref:`sec.certificates`
* - ````
- Define human-readable identity and ownership.
- ``type`` plus ````, ````, ````, and optional ````.
- :ref:`sec.description`
* - ````
- Define versions, package manager behavior, and one or more image types.
- Optional ``arch`` and ``profiles`` filters; includes ````, ````, ````, locale, timezone, themes, and release settings.
- :ref:`sec.preferences`
* - ````
- Group conditional variants of the same description.
- ```` entries with ``name``, ``description``, ``arch``, ``import``, and optional ````.
- :ref:`sec.profiles`
* - ````
- Create or adjust users and groups in the image.
- User records, group membership, home, shell, and password data.
- :ref:`sec.users`
* - ````
- Add driver files to the image description.
- File references with optional profile filters.
- :ref:`sec.drivers`
* - ````
- Remove files, libraries, or toolchains from the prepared root tree.
- Required ``type`` (``delete``, ``tools``, or ``libs``) with one or more ```` entries.
- :ref:`sec.strip`
* - ````
- Point KIWI to package sources.
- Repository type, source type, priority, GPG behavior, credentials, and source URLs.
- :ref:`sec.repository`
* - ````
- Define containers to fetch from a registry into the image.
- Required ``source`` and ``backend`` with one or more ```` entries.
- :ref:`sec.registry`
* - ````
- Define what KIWI installs, deletes, or imports.
- ``type``, optional ``profiles``, ``patternType``, ``bootstrap_package`` with package, collection, product, file, ignore, and archive entries.
- :ref:`sec.packages`
* - ````
- Attach custom XML namespaces validated outside the built-in schema.
- Arbitrary namespaced content.
- :ref:`sec.extension`
What to Configure First
-----------------------
When you create or review an image description, work in this order:
#. Start with :ref:`sec.description` so the image has clear ownership and a
purpose.
#. Add at least one :ref:`sec.preferences` block with a version, package
manager, and one or more :ref:`type definitions `.
#. Add the :ref:`sec.repository` entries that provide the packages needed for
the build.
#. Add one or more :ref:`sec.packages` sections to populate the root tree.
#. Add optional sections such as :ref:`sec.users`, :ref:`sec.profiles`, or
:ref:`sec.certificates` only when the use case needs them.
Common Patterns
---------------
Use profiles when one description should build multiple variants.
.. code:: xml
1.0.0zypper1.0.0zypper
Use multiple package sections to separate bootstrap packages from the final
image content.
.. code:: xml
Complete Schema Reference
-------------------------
The exhaustive element and attribute reference is documented in
:doc:`image_description/elements`. That reference follows the schema in
:file:`kiwi/schema/kiwi.rnc` and covers:
* every top-level section allowed below ````;
* all common and type-specific attributes of ````;
* 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
:doc:`image_description/elements` as the schema-backed lookup for every valid
section and attribute.
.. toctree::
:maxdepth: 1
image_description/elements.rst