Skip to content

[unix_distributions][fedora] Use chunkah to optimize bootc container updates #1214

@LukeShortCloud

Description

@LukeShortCloud

Side note: bootc notes should be refactored into the [virtualization][containers] notes now that it is distro-agnostic.

chunkah helps to speed up updates by reorganizing layers to contain related files. No infrastructure changes are needed.

Steps to use chunkah:

  1. As the last RUN command in a container, add file attribute tags for related files (it is recommended to tag all files from each individual package as being related).
  2. Run chunkah on the built container to reorganize the layers based on those file attributes.

https://github.com/coreos/chunkah

Example of step 1 for different Lnux distributions:

Arch Linux:

pacman -Qq | while read -r pkgname; do
  echo "Setting file attributes for package: $pkgname (chunkah)"
  pacman -Qlq "$pkgname" | while read -r filepath; do
    if [[ -f "$filepath" ]]; then
       setfattr -n user.component -v "$pkgname" "$filepath" || true
    fi
  done
done

Debian:

# Set file attributes for packages for chunkah to handle.
dpkg-query -W -f='${Package}\n' | while read -r pkgname; do
  echo "Setting file attributes for package: $pkgname (chunkah)"
  dpkg -L "$pkgname" | while read -r filepath; do
    if [[ -f "$filepath" ]]; then
      setfattr -n user.component -v "$pkgname" "$filepath" || true
    fi
  done
done

https://github.com/frostyard/snosi/blob/09d22407f138307f94b6440fac1d3484a53a5bd3/shared/outformat/image/finalize/mkosi.finalize.chroot#L41

Fedora:

rpm -qa | while read -r pkgname; do
  echo "Setting file attributes for package: $pkgname (chunkah)"
  rpm -ql "$pkgname" | while read -r filepath; do
    if [[ -f "$filepath" ]]; then
       setfattr -n user.component -v "$pkgname" "$filepath" || true
    fi
  done
done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions