103.3. containers-common-1
/etc/containers — the engine, storage, registry and image-trust configuration podman, buildah and skopeo share
The build-state snapshot was taken from 1-1; this recipe is 1-2, so the size, time and contents below describe the earlier build.
| Version | 1, release 2 |
| Shelf | containers — Container runtimes, image tools, container networking and sandbox primitives |
| Phase | 41_system (System), 303 of 1047 in build order |
| Licence | MIT |
| Homepage | https://github.com/kunaldawn/kdos |
| Build time | 0.1 SBU |
| Installed size | 538 B in 4 files |
| Recipe | ports/core/containers/containers-common/kpkgbuild |
About
containers-common is KDOS’s own port with no upstream source: it writes /etc/containers, the configuration that podman, buildah and skopeo all read, so one package owns it and all three depend on it. Four files make it: the engine’s containers.conf, the image store’s storage.conf, registries.conf for short image names, and the image trust policy policy.json. What each sets is tabled in Containers.
Sources
None: the port builds from its own directory, /ports/core/containers/containers-common.
Dependencies
Depends on: fuse-overlayfs.
Required by (3): buildah, podman, skopeo.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install containers-common'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/containers/containers-common.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/containers-common
SRC=$SRC_ROOT/containers-common-1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
install -d "$PKG/etc/containers"
cat > "$PKG/etc/containers/containers.conf" <<'EOF2'
[engine]
cgroup_manager = "cgroupfs"
events_logger = "file"
runtime = "crun"
[network]
network_backend = "netavark"
firewall_driver = "nftables"
default_rootless_network_cmd = "pasta"
EOF2
cat > "$PKG/etc/containers/storage.conf" <<'EOF2'
[storage]
driver = "overlay"
[storage.options.overlay]
mount_program = "/usr/bin/fuse-overlayfs"
EOF2
cat > "$PKG/etc/containers/registries.conf" <<'EOF2'
unqualified-search-registries = ["docker.io"]
EOF2
cat > "$PKG/etc/containers/policy.json" <<'EOF2'
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports": {
"docker-daemon": {
"": [{"type": "insecureAcceptAnything"}]
}
}
}
EOF2
chmod 0644 "$PKG/etc/containers/containers.conf" \
"$PKG/etc/containers/storage.conf" \
"$PKG/etc/containers/registries.conf" \
"$PKG/etc/containers/policy.json"
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/containers-common, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf containers-common-1-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/containers-common, and runs the triggers its paths call for.
Contents
Installed directories: /etc/containers.
Notes
Each value follows from something else in the system:
cgroup_manager = "cgroupfs", because there is no systemd to delegate a cgroup;events_logger = "file"for the same reason, there being no journal.runtime = "crun",network_backend = "netavark"withfirewall_driver = "nftables", anddefault_rootless_network_cmd = "pasta"name the ports the tree carries: crun, netavark with aardvark-dns, and passt.storage.confpins the overlay driver mounted through fuse-overlayfs, the onedependsentry, because a live session’s home sits on the boot overlay and the kernel will not stack an overlay’s writable layer on another; see Storage drivers for when an installed system switches a user to the kernel’s own driver.policy.jsonis upstream’s default,insecureAcceptAnything, which checks no signature, and without anypolicy.jsonevery pull refuses to start; see Containers in the security model.