Ejemplo de Imagen de Bootc de Fedora IoT con Quay

Crear y Arrancar una Imagen de Fedora IoT Bootc

This example walks through building and booting a Fedora IoT bootc image using Quay.io, as well as pushing an update to a booted Fedora IoT system.

This example is based on the Fedora bootc documentation about building scratch images; reference the upstream docs here for the latest version/information.
Este ejemplo asume que el usuario tiene una cuenta Quay con la habilidad de crear repositorios personales.

Para comenzar, cree un Containerfile.custom con el contenido siguiente:

FROM quay.io/fedora-testing/fedora-bootc:rawhide-standard como constructor
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"]

You’re now ready to build a Fedora IoT bootc image using the custom Containerfile you made earlier. Use this command:

podman build --cap-add=all --security-opt=label=type:container_runtime_t \
--device /dev/fuse -t localhost/fedora-iot -f Containerfile.custom .

Then, tag your Fedora IoT bootc image:

etiquetado podman de localhost/fedora-iot:última quay.io/[nombre repo quay]_fedora-iot

Antes de proporcionar a Quay.io, puede necesitar acceder:

podman login quay.io

Push your new Fedora IoT bootc image to Quay.io using the following command. Note that you may need to log in again:

podman push quay.io/[nombre repositorio quay]:fedora-iot
El siguiente paso utiliza podman-bootc. Si necesita instalar podman-bootc, por favor siga las instrucciones en el repositorio podman-bootc

Now, boot your Fedora IoT bootc image. Open a new terminal window and run:

podman-bootc run --filesystem=ext4 quay.io/[quay repository name]:fedora-iot

podman-bootc will pull your image and boot it inside a VM in the terminal window, allowing you to test everything Fedora IoT bootc images have to offer.

Cómo enviar una actualización a su sistema de arranque bootc Fedora IoT

After completing the tutorial above, you now have a functional Fedora IoT bootc system! But what if you need to make a change? Updating a bootc system is remarkably simple — just follow the steps below.

This tutorial assumes you have just completed the above tutorial, and have access to a booted Fedora IoT bootc system.

First, navigate to your cloned Fedora Bootc Base Images repository and create a Containerfile named Containerfile.fix with your desired changes.

Next, rebuild your localhost/fedora-iot image using the new Containerfile:

podman build --cap-add=all --security-opt=label=type:container_runtime_t \
--device /dev/fuse -t localhost/fedora-iot -f Containerfile.fix .

Tag your updated Fedora IoT bootc image:

etiquetado podman de localhost/fedora-iot:última quay.io/[nombre repo quay]_fedora-iot

Antes de proporcionar a Quay.io, puede necesitar acceder:

podman login quay.io

Push your updated Fedora IoT bootc image to Quay.io, using the command below:

podman push quay.io/[nombre repositorio quay]:fedora-iot

After successfully pushing, switch back to your virtual machine running your Fedora IoT bootc image. Download and queue the updated image for your next reboot:

bootc upgrade

Ejecute la siguiente instrucción para ver su imagen actualizada establecida para el siguiente rearranque:

bootc status

Reboot your Fedora IoT bootc system and use your new updated image:

reiniciar

After rebooting, you may need to SSH back into your Fedora IoT bootc system. To do so, first list all podman-bootc VMs:

podman-bootc list

Después encuentre el ID de su máquina deseada y ejecute lo siguiente:

podman-bootc ssh [ID]

Tras reconectar, ejecute la comprobación del estado de nuevo:

bootc status

Su imagen actualizada ahora mostraría como Booted, y la imagen anterior como Rollback. Ha actualizado correctamente su sistema bootc de Fedora IoT.