summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonin Godard <antonin.godard@bootlin.com>2025-12-17 10:16:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2026-01-26 09:41:30 +0000
commit71615e330caa7d60920874eaf6bde4ffe37dd6a9 (patch)
tree6f4a3ceac3f3a744adb702844e969aef6ae97bf6
parent9b6d0d6e5af8fb39c455b7fadeb18aa154c2ed13 (diff)
downloadpoky-71615e330caa7d60920874eaf6bde4ffe37dd6a9.tar.gz
ref-manual/classes.rst: document the image-container class
Add documentation for the image-container class, which is a simple class to generate an image suitable for creating a container. This answers in part to questions asked in [YOCTO #14368]. It also adds documentation for IMAGE_CONTAINER_NO_DUMMY, which was added in OE-Core with commit f0645e172bb8 ("image-container.bbclass: Error if not using linux-dummy"). Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> (From yocto-docs rev: 85fb6e4a964ea2dea9c3083ba2c4ceb336f34b1a) Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> (cherry picked from commit 6ce00e5875eb3469fefd55cc22acaaeaf620053a) Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--documentation/ref-manual/classes.rst47
-rw-r--r--documentation/ref-manual/variables.rst18
2 files changed, 65 insertions, 0 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index bc7ccb8b71..a6cf586dd5 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -1248,6 +1248,53 @@ The :ref:`ref-classes-image_types` class also handles conversion and compression
1248 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk 1248 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
1249 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images. 1249 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
1250 1250
1251.. _ref-classes-image-container:
1252
1253``image-container``
1254===================
1255
1256The :ref:`ref-classes-image-container` class is automatically inherited in
1257:doc:`image </ref-manual/images>` recipes that have the ``container`` image type
1258in :term:`IMAGE_FSTYPES`. It provides relevant settings to generate an image
1259ready for use with an :wikipedia:`OCI <Open_Container_Initiative>`-compliant
1260container management tool, such as :wikipedia:`Podman <Podman>` or
1261:wikipedia:`Docker <Docker_(software)>`.
1262
1263.. note::
1264
1265 This class neither builds nor installs container management tools on the
1266 target. Those tools are available in the :yocto_git:`meta-virtualization
1267 </meta-virtualization>` layer.
1268
1269You should set the :term:`PREFERRED_PROVIDER` for the Linux kernel to
1270``linux-dummy`` in a :term:`configuration file`::
1271
1272 PREFERRED_PROVIDER_virtual/kernel = "linux-dummy"
1273
1274Otherwise an error is triggered. If desired, the
1275:term:`IMAGE_CONTAINER_NO_DUMMY` variable can be set to "1" to avoid triggering
1276this error.
1277
1278The ``linux-dummy`` recipe acts as a Linux kernel recipe but builds nothing. It
1279is relevant to use as the preferred Linux kernel provider in this case as a
1280container image does not need to include a Linux kernel. Selecting it as the
1281preferred provider for the kernel will also decrease build time.
1282
1283Using this class only deploys an additional ``tar.bz2`` archive to
1284:term:`DEPLOY_DIR_IMAGE`. This archive can be used in a container file (a file
1285typically named ``Dockerfile`` or ``Containerfile``). For example, to be used with
1286:wikipedia:`Podman <Podman>` or :wikipedia:`Docker <Docker_(software)>`, the
1287`container file <https://docs.docker.com/reference/dockerfile/>`__ could contain
1288the following instructions:
1289
1290.. code-block:: dockerfile
1291
1292 FROM scratch
1293 ADD ./image-container-qemux86-64.rootfs.tar.bz2 /
1294 ENTRYPOINT /bin/sh
1295
1296This is suitable to build a container using our generated root filesystem image.
1297
1251.. _ref-classes-image-live: 1298.. _ref-classes-image-live:
1252 1299
1253``image-live`` 1300``image-live``
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 5b4561fc12..a67090308b 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -3837,6 +3837,24 @@ system and gives an overview of their function and contents.
3837 variable, see the :ref:`ref-classes-image_types` 3837 variable, see the :ref:`ref-classes-image_types`
3838 class file, which is ``meta/classes-recipe/image_types.bbclass``. 3838 class file, which is ``meta/classes-recipe/image_types.bbclass``.
3839 3839
3840 :term:`IMAGE_CONTAINER_NO_DUMMY`
3841 When an image recipe has the ``container`` image type in
3842 :term:`IMAGE_FSTYPES`, it expects the :term:`PREFERRED_PROVIDER` for
3843 the Linux kernel (``virtual/kernel``) to be set to ``linux-dummy`` from a
3844 :term:`configuration file`. Otherwise, an error is triggered.
3845
3846 When set to "1", the :term:`IMAGE_CONTAINER_NO_DUMMY` variable allows the
3847 :term:`PREFERRED_PROVIDER` variable to be set to another value, thus
3848 skipping the check and not triggering the build error. Any other value
3849 will keep the check.
3850
3851 This variable should be set from the image recipe using the ``container``
3852 image type.
3853
3854 See the documentation of the :ref:`ref-classes-image-container` class for
3855 more information on why setting the :term:`PREFERRED_PROVIDER` to
3856 ``linux-dummy`` is advised with this class.
3857
3840 :term:`IMAGE_DEVICE_TABLES` 3858 :term:`IMAGE_DEVICE_TABLES`
3841 Specifies one or more files that contain custom device tables that 3859 Specifies one or more files that contain custom device tables that
3842 are passed to the ``makedevs`` command as part of creating an image. 3860 are passed to the ``makedevs`` command as part of creating an image.