Skip to content

Commit

Permalink
[WIP][unix_distributions][fedora] ostree container builds
Browse files Browse the repository at this point in the history
How to use them with Fedora and rpm-ostree.
  • Loading branch information
LukeShortCloud committed Jun 4, 2024
1 parent c2a34d6 commit 56927fe
Showing 1 changed file with 70 additions and 1 deletion.
71 changes: 70 additions & 1 deletion src/unix_distributions/fedora.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ Examples:
systemctl enable fedora-silverblue-readonly-sysroot.service
rpm-ostree compose
^^^^^^^^^^^^^^^^^^
''''''''''''''''''
Once the treefiles have been created, the rpm-ostree distribution can be built. It is recommended to use either Fedora Silverblue or Fedora Workstation as the host operating system for the build since they provide the required dependencies. The ``rpm-ostree`` command has to be ran with elevated privileges or else it will not work properly.
Expand Down Expand Up @@ -1098,6 +1098,72 @@ Once the treefiles have been created, the rpm-ostree distribution can be built.
[17][18]
Container
^^^^^^^^^
A Containerfile can be used to create a container image for use as the root file system.
::
FROM <CONTAINER_REGISTRY>/<CONTAINER_REGISTRY_PROJECT>/<CONTAINER_NAME>:<CONTAINER_TAG>
The base container image to start with needs to have ``rpm-ostree`` installed and configured. Either use an existing image or use a Treefile to build a new base image.
**Existing Images**
Minimal images [45]:
- CentOS Stream = quay.io/centos-bootc/centos-bootc:stream9
- Fedora = quay.io/fedora/fedora-bootc:40
- Fedora CoreOS (following the latest stable Fedora Atomic Desktop version) = quay.io/fedora/fedora-coreos:testing
Images with desktop enviornments:
- Fedora Atomic Desktop with GNOME = quay.io/fedora/fedora-silverblue
- Fedora Atomic Desktop with KDE Plasma = quay.io/fedora/fedora-kinoite
**Treefile**
Build a container image archive.
- First build:
.. code-block:: sh
$ rpm-ostree compose image --initialize --format=ociarchive <TREEFILE>.yaml <CONTAINER_NAME>.ociarchive
- Next builds:
.. code-block:: sh
$ rpm-ostree compose image --initialize-mode=if-not-exists --format=ociarchive <TREEFILE>.yaml <CONTAINER_NAME>.ociarchive
Build a container image and then push it to a container registry. [46]
- First build:
.. code-block:: sh
$ rpm-ostree compose image --initialize --format=registry <TREEFILE>.yaml <CONTAINER_REGISTRY>/<CONTAINER_REGISTRY_PROJECT>/<CONTAINER_NAME>:<CONTAINER_TAG>
- Next builds:
.. code-block:: sh
$ rpm-ostree compose image --initialize-mode=if-not-exists --format=registry <TREEFILE>.yaml <CONTAINER_REGISTRY>/<CONTAINER_REGISTRY_PROJECT>/<CONTAINER_NAME>:<CONTAINER_TAG>
It is possible to convert an ostree repository to a container image [46] but not the other way around. [47]
.. code-block:: sh
$ ostree container encapsulate --repo=<OSTREE_REPOSITORY_PATH> <OSTREE_REFERENCE> docker://<CONTAINER_REGISTRY>/<CONTAINER_REGISTRY_PROJECT>/<CONTAINER_NAME>:<CONTAINER_IMAGE>
**Kickstart**
::
ostreecontainer --no-signature-verification --url <CONTAINER_REGISTRY>/<CONTAINER_REGISTRY_PROJECT>/<CONTAINER_NAME>:<CONTAINER_IMAGE>
Reset
~~~~~
Expand Down Expand Up @@ -1264,3 +1330,6 @@ Bibliography
42. "Fedora CoreOS (FCOS)." OKD 4. Accessed May 22, 2024. https://docs.okd.io/latest/architecture/architecture-rhcos.html
43. "Major Changes in Fedora CoreOS." Fedora Docs. May 22, 2024. Accessed May 22, 2024. https://docs.fedoraproject.org/en-US/fedora-coreos/major-changes/
44. "General Availability of AlmaLinux 9.4 Stable!" AlmaLinux OS. May 6, 2024. Accessed June 3, 2024. https://almalinux.org/blog/2024-05-06-announcing-94-stable/
45. "Getting Started with Fedora/CentOS bootc." Fedora Docs. June 3, 2024. Accessed June 3, 2024. https://docs.fedoraproject.org/en-US/bootc/getting-started/
46. "ostree native containers." rpm-ostree. Accessed June 3, 2024. https://coreos.github.io/rpm-ostree/container/
47. "containers: support converting existing base images? #11." GitHub ostreedev/ostree-rs-ext. May 21, 2024. Accessed June 3, 2024. https://github.com/ostreedev/ostree-rs-ext/issues/11

0 comments on commit 56927fe

Please sign in to comment.