Re: [PATCH V2] buildah: add recipe for buildah v1.26

Bruce Ashfield

On Tue, Jun 7, 2022 at 9:50 AM Sakib Sajal <sakib.sajal@...> wrote:

On 2022-06-07 08:59, Bruce Ashfield wrote:
[Please note: This e-mail is from an EXTERNAL e-mail address]

On Wed, May 25, 2022 at 7:43 PM <sakib.sajal@...> wrote:
buildah is a command line tool, to be installed and run on target,
that can be used to:
- create a working container, either from scratch or using an image
as a starting point
- create an image, either from a working container or via the
instructions in a Dockerfile
- images can be built in either the OCI image format or the
traditional upstream docker image format
- mount a working container's root filesystem for manipulation
- unmount a working container's root filesystem
- use the updated contents of a container's root filesystem as a
filesystem layer to create a new image
- delete a working container or an image
- rename a local container

Setup the build directory:
$ . oe-init-build-env <build_dir>

Add to local.conf:
IMAGE_INSTALL:append = " buildah kernel-modules"
KERNEL_FEATURES += "features/overlayfs/overlayfs.cfgi \
features/netfilter/netfilter.scc \

Build image:
$ bitbake core-image-minimal

Run the image:
$ runqemu nographic kvm qemuparams="-m 4096"

On target:
Pull an image:
> cnt=$(buildah from fedora)

Or build from Dockerfile
> buildah bud -t <image_name>:<tag> .

Mount the image:
> mnt=$(buildah mount ${cnt})

Install packages on the container rootfs:
> dnf install --installroot $mnt <packages_to_install> -y

Copy local files to the container:
> buildah copy $cnt <local_file> <dest_on_container>

Save the changes to an image
> buildah commit --format docker $cnt <name>:<tag>

Run the image using buildah:
> buildah run $cnt /bin/sh

Or using docker:
> docker run -it <name>:<tag>
I haven't forgotten about this, just with the storms and power outages
here in Ottawa, I'm running way behind in my patch processing.

Thank you for the update, I was about to ping you regarding this.
I've been held up with some larger system integration issues for the
past week or so, I've got this staged locally and will get it tested
and merged as soon as possible.



Signed-off-by: Sakib Sajal <sakib.sajal@...>
recipes-containers/buildah/ | 57 +++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 recipes-containers/buildah/

diff --git a/recipes-containers/buildah/ b/recipes-containers/buildah/
new file mode 100644
index 0000000..024e82c
--- /dev/null
+++ b/recipes-containers/buildah/
@@ -0,0 +1,57 @@
+SUMMARY = "A tool that facilitates building OCI container images."
+DESCRIPTION = "A tool that facilitates building OCI container images."
+# Apache-2.0 for containerd
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/;md5=e3fc50a88d0a364313df4b21ef20c29e"
+S = "${WORKDIR}/git"
+SRCREV_buildah = "0a9d6e6eaef2e2e7936313d449a4e226022eb865"
+inherit go
+inherit goarch
+inherit pkgconfig
+GOBUILDFLAGS += "-mod vendor"
+SRC_URI = " \
+ git://;branch=release-${BUILDAH_VERSION};name=buildah;protocol=https \
+ "
+DEPENDS = "libdevmapper btrfs-tools gpgme"
+RDEPENDS:${PN} = "cgroup-lite fuse-overlayfs libdevmapper podman"
+RDEPENDS:${PN}-dev = "bash perl"
+do_compile:prepend() {
+ cd ${S}/src/
+go_do_compile() {
+ export TMPDIR="${GOTMPDIR}"
+ if [ -n "${GO_INSTALL}" ]; then
+ if [ -n "${GO_LINKSHARED}" ]; then
+ ${GO} install ${GOBUILDFLAGS} ./cmd/buildah
+ ${GO} install ${GOBUILDFLAGS} ./tests/imgtype/imgtype.go
+ ${GO} install ${GOBUILDFLAGS} ./tests/copy/copy.go
+ rm -rf ${B}/bin
+ fi
+ ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} ./cmd/buildah
+ ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} ./tests/imgtype/imgtype.go
+ ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} ./tests/copy/copy.go
+ fi
+do_install:append() {
+ dest_dir=${D}/${sysconfdir}/containers
+ mkdir -p ${dest_dir}
+ install -m 666 ${S}/src/ ${dest_dir}/buildah.registries.conf.sample
+ install -m 666 ${S}/src/ ${dest_dir}/buildah.policy.json.sample

- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Join { to automatically receive all group messages.