diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-01 17:08:35 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-02-09 03:32:52 +0000 |
| commit | c32e1081c81ba27f0d5a21a1885601f04d329d21 (patch) | |
| tree | a7e44880e69068d44e7e89d49af8ce709784a03f /recipes-containers/container-host-config | |
| parent | 79d03d5350c446223c847135c7115a656adc01d9 (diff) | |
| download | meta-virtualization-c32e1081c81ba27f0d5a21a1885601f04d329d21.tar.gz | |
container-cross-install: add bbclass for bundling containers into images
This class enables bundling pre-built OCI containers into Yocto images
at build time. It uses vdkr/vpdmn to process containers via QEMU,
producing properly formatted storage that can be merged into the
target rootfs.
Two mechanisms for bundling containers:
1. BUNDLED_CONTAINERS variable (direct specification):
- Set in local.conf or image recipe
- Format: "name:runtime[:autostart][:external]"
- Dependencies auto-generated at parse time
- Example: BUNDLED_CONTAINERS = "container-base:docker:autostart"
2. container-bundle packages (package-based):
- Recipes inherit container-bundle.bbclass to create packages
- Installing packages via IMAGE_INSTALL triggers processing
- merge_installed_bundles() scans installed OCI directories
- Runs vrunner once in batch-import mode for efficiency
Automatic dependency generation for BUNDLED_CONTAINERS:
- Parses entries at recipe parse time via python __anonymous()
- Derives recipe name from OCI dir names (strips -latest-oci/-oci suffix)
- Generates do_rootfs[depends] on recipe:do_image_complete
- Use :external tag to skip dependency for third-party blobs
- Single "bitbake container-image-host" builds containers + image
Usage in image recipe:
inherit container-cross-install
Features:
- Automatic detection of target architecture
- Support for both Docker and Podman runtimes
- Batch import mode for efficiency with multiple containers
- Autostart support via systemd services (Docker) or Quadlet (Podman)
- Integration with vrunner for QEMU-based processing
- Backwards compatible with legacy -latest-oci naming convention
The class processes containers during do_rootfs and merges the
resulting storage into /var/lib/docker or /var/lib/containers.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/container-host-config')
| -rw-r--r-- | recipes-containers/container-host-config/container-host-config/storage.conf | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/recipes-containers/container-host-config/container-host-config/storage.conf b/recipes-containers/container-host-config/container-host-config/storage.conf index cb4525f2..50cb9c91 100644 --- a/recipes-containers/container-host-config/container-host-config/storage.conf +++ b/recipes-containers/container-host-config/container-host-config/storage.conf | |||
| @@ -14,7 +14,10 @@ | |||
| 14 | [storage] | 14 | [storage] |
| 15 | 15 | ||
| 16 | # Default Storage Driver, Must be set for proper operation. | 16 | # Default Storage Driver, Must be set for proper operation. |
| 17 | driver = "overlay" | 17 | # Using VFS driver for compatibility with cross-compiled container images. |
| 18 | # VFS is slower than overlay but avoids permission issues when deploying | ||
| 19 | # pre-built containers during Yocto image build (under pseudo/fakeroot). | ||
| 20 | driver = "vfs" | ||
| 18 | 21 | ||
| 19 | # Temporary storage location | 22 | # Temporary storage location |
| 20 | runroot = "/run/containers/storage" | 23 | runroot = "/run/containers/storage" |
| @@ -109,6 +112,9 @@ pull_options = {enable_partial_images = "false", use_hard_links = "false", ostre | |||
| 109 | # auto-userns-max-size=65536 | 112 | # auto-userns-max-size=65536 |
| 110 | 113 | ||
| 111 | [storage.options.overlay] | 114 | [storage.options.overlay] |
| 115 | # NOTE: Using VFS driver, so overlay options are not used but kept for reference | ||
| 116 | # if switching back to overlay driver. | ||
| 117 | |||
| 112 | # ignore_chown_errors can be set to allow a non privileged user running with | 118 | # ignore_chown_errors can be set to allow a non privileged user running with |
| 113 | # a single UID within a user namespace to run containers. The user can pull | 119 | # a single UID within a user namespace to run containers. The user can pull |
| 114 | # and use any image even those with multiple uids. Note multiple UIDs will be | 120 | # and use any image even those with multiple uids. Note multiple UIDs will be |
| @@ -125,7 +131,8 @@ pull_options = {enable_partial_images = "false", use_hard_links = "false", ostre | |||
| 125 | #mount_program = "/usr/bin/fuse-overlayfs" | 131 | #mount_program = "/usr/bin/fuse-overlayfs" |
| 126 | 132 | ||
| 127 | # mountopt specifies comma separated list of extra mount options | 133 | # mountopt specifies comma separated list of extra mount options |
| 128 | mountopt = "nodev" | 134 | # Commented out for VFS driver compatibility |
| 135 | #mountopt = "nodev" | ||
| 129 | 136 | ||
| 130 | # Set to skip a PRIVATE bind mount on the storage home directory. | 137 | # Set to skip a PRIVATE bind mount on the storage home directory. |
| 131 | # skip_mount_home = "false" | 138 | # skip_mount_home = "false" |
