Skip to content

Commit a408792

Browse files
authored
Merge pull request #1005 from cgwalters/doc-baseimage-config
docs/bootc-images: Refresh a bit
2 parents 6a2b7e0 + bf58c7b commit a408792

File tree

1 file changed

+39
-49
lines changed

1 file changed

+39
-49
lines changed

docs/src/bootc-images.md

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,44 @@
11
# "bootc compatible" images
22

3-
At the current time, it does not work to just do:
3+
It is a toplevel goal of this project to tightly integrate
4+
with the OCI ecosystem and make booting containers a normal
5+
activity.
46

5-
```Dockerfile
6-
FROM fedora
7-
RUN dnf -y install kernel
8-
```
9-
10-
or
7+
However, there are a number of basic requirements and integration
8+
points, some of which have distribution-specific variants.
119

12-
```Dockerfile
13-
FROM debian
14-
RUN apt install linux
15-
```
10+
Further at the current time, the bootc project makes a lot
11+
of use of ostree, and this can appear in the base image
12+
requirements.
1613

17-
And get an image compatible with bootc. Supporting any base image
18-
is an eventual goal, however there are a few reasons why
19-
this doesn't yet work. The biggest reason is SELinux
20-
labeling support; the underlying ostree stack currently
21-
handles this and requires that the "base image"
22-
have a pre-computed set of labels that can be used
23-
for any derived layers.
14+
## ostree-in-container
2415

25-
# Building bootc compatible base images
16+
With [bootc 1.1.3](https://github.com/containers/bootc/releases/tag/v1.1.3)
17+
or later, it is no longer required to have a `/ostree` directory
18+
present in the base image.
2619

27-
As a corollary to base-image limitations, the build process
28-
for generating base images currently requires running
29-
through ostree tooling to generate an "ostree commit"
30-
which has some special formatting in the base image.
20+
To generate container images which do include `/ostree` from scratch,
21+
the underlying `ostree container` tooling is designed to operate
22+
on an existing ostree commit, and the `ostree container encapsulate`
23+
command can turn the commit into an OCI image. If you already
24+
have a pipeline which prdouces ostree commits as an output
25+
(e.g. using [osbuild](https://www.osbuild.org/guides/image-builder-on-premises/building-ostree-images.html)
26+
to produce `ostree` commit artifacts), then this allows a
27+
seamless transition to a bootc/OCI compatible ecosystem.
3128

32-
The two most common ways to do this are to either:
29+
## Higher level base image build tooling
3330

34-
1. compose a compatible OCI image directly via [`rpm-ostree compose image`](https://coreos.github.io/rpm-ostree/container/#creating-base-images)
35-
1. encapsulate an ostree commit using `rpm-ostree compose container-encapsulate`
31+
A well tested tool to produce compatible base images is
32+
[`rpm-ostree compose image`](https://coreos.github.io/rpm-ostree/container/#creating-base-images),
33+
which is used by the [Fedora base image](https://gitlab.com/fedora/bootc/base-images).
3634

37-
The first method is most direct, as it streamlines the process of
38-
creating a base image and writing to a registry. The second method
39-
may be preferable if you already have a build process that produces `ostree`
40-
commits as an output (e.g. using [osbuild](https://www.osbuild.org/guides/image-builder-on-premises/building-ostree-images.html)
41-
to produce `ostree` commit artifacts.)
35+
## Standard image content
4236

43-
The requirement for both methods is that your initial treefile/manifest
44-
**MUST** include the `bootc` package in list of packages included in your compose.
45-
46-
However, the ostree usage is an implementation detail
47-
and the requirement on this will be lifted in the future.
37+
The bootc project provides a [baseimage](../../baseimage) reference
38+
set of configuration files for base images. In particular at
39+
the current time the content defined by `base` must be used
40+
(or recreated). There is also suggested integration there with
41+
e.g. `dracut` to ensure the initramfs is set up, etc.
4842

4943
## Standard metadata for bootc compatible images
5044

@@ -56,7 +50,7 @@ LABEL containers.bootc 1
5650

5751
This will signal that this image is intended to be usable with `bootc`.
5852

59-
# Deriving from existing base images
53+
## Deriving from existing base images
6054

6155
It's important to emphasize that from one
6256
of these specially-formatted base images, every
@@ -82,20 +76,22 @@ Bootc will take care of copying the kernel/initramfs as needed from the containe
8276

8377
Future work for supporting UKIs will follow the recommendations of the uapi-group in [Locations for Distribution-built UKIs Installed by Package Managers](https://uapi-group.org/specifications/specs/unified_kernel_image/#locations-for-distribution-built-ukis-installed-by-package-managers).
8478

79+
The `bootc container lint` command will check this.
80+
8581
## The `ostree container commit` command
8682

8783
You may find some references to this; it is no longer very useful
8884
and is not recommended.
8985

90-
# The bootloader setup
86+
## The bootloader setup
9187

9288
At the current time bootc relies on the [bootupd](https://github.com/coreos/bootupd/)
9389
project which handles bootloader installs and upgrades. The invocation of
9490
`bootc install` will always run `bootupd` to perform installations.
9591
Additionally, `bootc upgrade` will currently not upgrade the bootloader;
9692
you must invoke `bootupctl update`.
9793

98-
# SELinux
94+
## SELinux
9995

10096
Container runtimes such as `podman` and `docker` commonly
10197
apply a "coarse" SELinux policy to running containers.
@@ -108,9 +104,9 @@ and there are no individually distinct e.g. `etc_t` and
108104
`usr_t` types.
109105

110106
In contrast, with the current OSTree backend for bootc,
111-
when the base image is built, label metadata is included
112-
in special metadata files in `/sysroot/ostree` that correspond
113-
to components of the base image.
107+
it is possible to include label metadata (and precomputed ostree
108+
checksums) in special metadata files in `/sysroot/ostree` that correspond
109+
to components of the base image. This is optional as of bootc v1.1.3.
114110

115111
File content in derived layers will be labeled using the default file
116112
contexts (from `/etc/selinux`). For example, you can do this (as of
@@ -152,13 +148,7 @@ References:
152148

153149
It is strongly recommended to enable the ostree composefs
154150
backend (but not strictly required) for bootc.
155-
Do so by ensuring you have this in your `/usr/lib/ostree/prepare-root.conf`:
156151

157-
```
158-
[composefs]
159-
enabled = yes
160-
[sysroot]
161-
readonly = true
162-
```
152+
A reference enablement file to do so is in the [baseimage/base](../../baseimage/base).
163153

164154
More in [ostree-prepare-root](https://ostreedev.github.io/ostree/man/ostree-prepare-root.html).

0 commit comments

Comments
 (0)