Fedora IoT Bootc Image Example with Podman Machine

This example walks through building and booting a Fedora IoT bootc image in a Podman machine.

This example is based on the Fedora bootc documentation about building scratch images; reference the upstream docs here for the latest version/information.

To start, create a Containerfile.custom with the following contents:

FROM quay.io/fedora-testing/fedora-bootc:rawhide-standard as builder
RUN /usr/libexec/bootc-base-imagectl build-rootfs --manifest=fedora-iot /target-rootfs

FROM scratch
COPY --from=builder /target-rootfs/ /
LABEL containers.bootc 1
ENV container=oci
STOPSIGNAL SIGRTMIN+3
CMD ["/sbin/init"]

Initialize your Podman machine using the following command. You may skip this step if you already have a podman machine.

podman machine init

Grant your Podman machine the permissions necessary to run your Fedora IoT bootc image using:

podman machine set --rootful

Start your Podman machine using

podman machine start

Use the following command to build your fedora-iot image:

podman -c podman-machine-default-root build --cap-add=all --security-opt=label=disable \
--device /dev/fuse -t localhost/fedora-iot -f Containerfile.custom .

After building the localhost/fedora-iot image, you should be able to see it in your Podman machine’s list of images. Use the following command to check:

podman -c podman-machine-default-root images
The next step uses podman-bootc. If you need to install podman-bootc, please follow the instructions in the podman-bootc repository

You’re now ready to boot a virtual machine using your new Fedora IoT bootc image. The command below will boot a VM in your current terminal window, allowing you to test everything that Fedora IoT bootc images have to offer:

podman-bootc run --filesystem=ext4 localhost/fedora-iot