22
33== Building and Booting a Fedora IoT Bootc Image
44
5- This example walks through building and booting a Fedora IoT bootc image using Quay.io, as well as pushing an update to a booted
5+ This example walks through building and booting a Fedora IoT ` bootc` image using Quay.io, as well as pushing an update to a booted
66Fedora IoT system.
77
8- NOTE: This example is based on the Fedora bootc documentation about building scratch images; reference the upstream docs
8+ NOTE: This example is based on the Fedora ` bootc` documentation about building scratch images; reference the upstream docs
99https://docs.fedoraproject.org/en-US/bootc/building-from-scratch/#_using_bootc_base_imagectl_build_rootfs[here] for the latest version/information.
1010
1111NOTE: This example assumes the user has a Quay account with the ability to create custom repositories.
1212
1313To start, create a `Containerfile.custom` with the following contents:
14+
15+ [source,dockerfile]
1416----
1517FROM quay.io/fedora-testing/fedora-bootc:rawhide-standard as builder
1618RUN /usr/libexec/bootc-base-imagectl build-rootfs --manifest=fedora-iot /target-rootfs
@@ -23,99 +25,127 @@ STOPSIGNAL SIGRTMIN+3
2325CMD ["/sbin/init"]
2426----
2527
26- You're now ready to build a Fedora IoT bootc image using the custom containerfile you made earlier. Use this command:
28+ You're now ready to build a Fedora IoT `bootc` image using the custom Containerfile you made earlier. Use this command:
29+
30+ [source,bash]
2731----
2832podman build --cap-add=all --security-opt=label=type:container_runtime_t \
2933--device /dev/fuse -t localhost/fedora-iot -f Containerfile.custom .
3034----
3135
32- Then, tag your Fedora IoT bootc image:
36+ Then, tag your Fedora IoT `bootc` image:
37+
38+ [source,bash]
3339----
3440podman tag localhost/fedora-iot:latest quay.io/[quay repository name]:fedora-iot
3541----
3642
37- Before pushing to Quay.io, you may need to log in:
38- ----
39- podman login quay.io
40- ----
43+ Before pushing to Quay.io, you may need to log in:
44+
45+ [source,bash]
46+ ----
47+ podman login quay.io
48+ ----
49+
50+ Push your new Fedora IoT `bootc` image to Quay.io using the following command. Note that you may need to log in again:
4151
42- Push your new Fedora IoT bootc image to Quay.io using the following command. Note that you may need to log in again:
52+ [source,bash]
4353----
4454podman push quay.io/[quay repository name]:fedora-iot
4555----
4656
47- NOTE: The next step uses `podman-bootc`. If you need to install `podman-bootc`, please follow the instructions in the
57+ NOTE: The next step uses `podman-bootc`. If you need to install `podman-bootc`, please follow the instructions in the
4858https://github.com/containers/podman-bootc[podman-bootc repository]
4959
50- Now, boot your Fedora IoT bootc image. Open a new terminal window and run:
60+ Now, boot your Fedora IoT `bootc` image. Open a new terminal window and run:
61+
62+ [source,bash]
5163----
5264podman-bootc run --filesystem=ext4 quay.io/[quay repository name]:fedora-iot
5365----
5466
55- `podman-bootc` will pull your image and boot it inside a VM in the terminal window,
56- allowing you to test everything Fedora IoT bootc images have to offer.
67+ `podman-bootc` will pull your image and boot it inside a VM in the terminal window,
68+ allowing you to test everything Fedora IoT ` bootc` images have to offer.
5769
5870== Pushing an Update to your Fedora IoT bootc system
5971
60- After completing the tutorial above, you now have a functional Fedora IoT bootc system! But what if you need to make a change?
61- Updating a bootc system is remarkably simple -- just follow the steps below.
72+ After completing the tutorial above, you now have a functional Fedora IoT ` bootc` system! But what if you need to make a change?
73+ Updating a ` bootc` system is remarkably simple -- just follow the steps below.
6274
63- NOTE: This tutorial assumes you have just completed the above tutorial, and have access to a booted Fedora IoT bootc system.
75+ NOTE: This tutorial assumes you have just completed the above tutorial, and have access to a booted Fedora IoT ` bootc` system.
6476
65- First, navigate to your cloned Fedora Bootc Base Images repository and create a containerfile named `Containerfile.fix` with your desired changes.
77+ First, navigate to your cloned Fedora Bootc Base Images repository and create a Containerfile named `Containerfile.fix` with your desired changes.
6678
67- Next, rebuild your `localhost/fedora-iot` image using the new containerfile:
79+ Next, rebuild your `localhost/fedora-iot` image using the new Containerfile:
80+
81+ [source,bash]
6882----
6983podman build --cap-add=all --security-opt=label=type:container_runtime_t \
7084--device /dev/fuse -t localhost/fedora-iot -f Containerfile.fix .
7185----
7286
73- Tag your updated Fedora IoT bootc image:
87+ Tag your updated Fedora IoT `bootc` image:
88+
89+ [source,bash]
7490----
7591podman tag localhost/fedora-iot:latest quay.io/[quay repository name]:fedora-iot
7692----
7793
7894Before pushing to Quay.io, you may need to log in:
95+
96+ [source,bash]
7997----
8098podman login quay.io
8199----
82100
83- Push your updated Fedora IoT bootc image to Quay.io, using the command below:
101+ Push your updated Fedora IoT `bootc` image to Quay.io, using the command below:
102+
103+ [source,bash]
84104----
85105podman push quay.io/[quay repository name]:fedora-iot
86106----
87107
88- After successfully pushing, switch back to your virtual machine running your Fedora IoT bootc image.
108+ After successfully pushing, switch back to your virtual machine running your Fedora IoT ` bootc` image.
89109Download and queue the updated image for your next reboot:
110+
111+ [source,bash]
90112----
91113bootc upgrade
92114----
93115
94116Run the following command to see your updated image staged for the next reboot:
117+
118+ [source,bash]
95119----
96120bootc status
97121----
98122
99- Reboot your Fedora IoT bootc system and use your new updated image:
123+ Reboot your Fedora IoT `bootc` system and use your new updated image:
124+
125+ [source,bash]
100126----
101127reboot
102128----
103129
104- After rebooting, you may need to ssh back into your Fedora IoT bootc system. To do so, first list all podman-bootc
105- VMs:
130+ After rebooting, you may need to SSH back into your Fedora IoT `bootc` system. To do so, first list all `podman-bootc` VMs:
131+
132+ [source,bash]
106133----
107134podman-bootc list
108135----
109136
110137Then find the ID of your desired machine and run the following:
138+
139+ [source,bash]
111140----
112141podman-bootc ssh [ID]
113142----
114143
115144After reconnecting, run check the status again:
145+
146+ [source,bash]
116147----
117148bootc status
118149----
119150
120- Your updated image should now show up
121- as `Booted`, and the previous image as `Rollback`. You have successfully updated your Fedora IoT bootc system!
151+ Your updated image should now show up as `Booted`, and the previous image as `Rollback`. You have successfully updated your Fedora IoT bootc system!
0 commit comments