public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Silvano Cirujano-Cuesta <silvano.cirujano-cuesta@siemens.com>,
	Benedikt Niedermayr <benedikt.niedermayr@siemens.com>,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH v4 5/5] doc: Describe how to use the container fetcher and loader
Date: Fri, 19 Jul 2024 18:38:43 +0200	[thread overview]
Message-ID: <049353103858d43105d45603619a7548f2a29579.1721407122.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1721407122.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 doc/user_manual.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index 776ae52c..2bdacbec 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1519,3 +1519,61 @@ SBUILD_CHROOT_PREINSTALL_EXTRA += "<base packages>"
 
 Then, in the dpkg recipe of your package, simply set `SBUILD_FLAVOR = "<your flavor>"`.
 To install additional packages into the sbuild chroot, add them to `SBUILD_CHROOT_PREINSTALL_EXTRA`.
+
+## Pre-install container images
+
+If an isar-generated image shall provide a container runtime, it may also be
+desirable to pre-install container images to avoid having to download them on
+first boot or because they may not be accessible outside of the build
+environment. Isar supports this scenario via two services, a container fetcher
+and a container loader.
+
+### Bitbake fetcher for containers
+
+The bitbake fetching protocol "docker://" allows to download pre-built images
+from container registries. The URL consists of the image path, followed by
+a recommended digest in the form `digest=sha256:<sha256sum>` and an optional
+tag in the form `tag=<tag>`. A digest is preferred over a tag to identify an
+image when fetching because it also allows to validate its integrity. If a tag
+is not specified, `latest` is used as tag name.
+
+In case a multi-arch image is specified, the fetcher will only pull for the
+package architecture of the requesting recipe (`PACKAGE_ARCH`). The fetched
+images are stored as zstd-compressed in docker-archive format in the
+`WORKDIR` of the recipe. The name of the image is derived from the container
+image name, replacing all `/` with `.` and appending `:<tag>.zst`. Example:
+`docker://debian;tag=bookworm` will be saved as `debian:bookworm.zst`.
+
+### Container loader helpers
+
+To create a Debian package which can carry container images and load them into
+local storage of docker or podman, there is a set of helpers available. To use
+them in an own recipe, add
+`require recipes-support/container-loader/docker-loader.inc` when using docker
+and `require recipes-support/container-loader/podman-loader.inc` when using
+podman. The loader will try to transfer the packaged image into the container
+runtime storage on boot, but only if no container image of the same name and
+tag is present already.
+
+Unless `CONTAINER_DELETE_AFTER_LOAD` is set to `1`, the source container images
+remain by default available and may be used again for loading the storage after
+it may have been emptied later on (factory reset).
+
+Source container images may either be fetched as binaries from a registry, see
+above, or built via isar as well.
+
+### Example
+
+This creates a debian package which will download, package and then load the
+`debian:bookworm-20240701-slim` container image into the docker container
+storage. The package will depend on `docker.io`, insuring that that basic
+runtime services are installed on the target as well. The packaged image will
+be deleted from the target device's rootfs after successful import.
+
+```
+require recipes-support/container-loader/docker-loader.inc
+
+CONTAINER_DELETE_AFTER_LOAD = "1"
+
+SRC_URI += "docker://debian;digest=sha256:f528891ab1aa484bf7233dbcc84f3c806c3e427571d75510a9d74bb5ec535b33;tag=bookworm-20240701-slim"
+```
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/049353103858d43105d45603619a7548f2a29579.1721407122.git.jan.kiszka%40siemens.com.

  parent reply	other threads:[~2024-07-19 16:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 16:38 [PATCH v4 0/5] Introduce container fetcher and pre-loader 'Jan Kiszka' via isar-users
2024-07-19 16:38 ` [PATCH v4 1/5] Introduce fetcher from container registries 'Jan Kiszka' via isar-users
2024-07-25 10:48   ` 'Niedermayr, BENEDIKT' via isar-users
2024-07-25 11:10     ` 'Niedermayr, BENEDIKT' via isar-users
2024-07-19 16:38 ` [PATCH v4 2/5] container-loader: Introduce helper to load container images into local registry 'Jan Kiszka' via isar-users
2024-07-19 16:38 ` [PATCH v4 3/5] meta-isar: Add demo packages for installing prebuilt containers 'Jan Kiszka' via isar-users
2024-07-19 16:38 ` [PATCH v4 4/5] ci: Add test cases for container fetching and loading 'Jan Kiszka' via isar-users
2024-07-30  7:44   ` Uladzimir Bely
2024-07-30 21:45     ` 'Jan Kiszka' via isar-users
2024-08-05  7:20       ` Uladzimir Bely
2024-07-19 16:38 ` 'Jan Kiszka' via isar-users [this message]
2024-08-08  6:35 ` [PATCH v4 0/5] Introduce container fetcher and pre-loader Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=049353103858d43105d45603619a7548f2a29579.1721407122.git.jan.kiszka@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=benedikt.niedermayr@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=silvano.cirujano-cuesta@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox