Skip to content

Commit e059df3

Browse files
authored
Merge pull request #162 from cgwalters/doc-base-images
README: Add more information on base images
2 parents ee94754 + 34051e7 commit e059df3

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ You can also build this project like any other Rust project, e.g. `cargo build -
6363

6464
Many users will be more interested in base (container) images.
6565

66+
To build base images "from scratch", see [docs/bootc-images.md].
67+
68+
For pre-built base images:
69+
6670
* [Fedora CoreOS](https://quay.io/repository/fedora/fedora-coreos) can be used as a base image; you will need to [enable bootc](https://github.com/coreos/rpm-ostree/blob/main/docs/bootc.md) there.
6771
* There is also an in-development [Project Sagano](https://gitlab.com/CentOS/cloud/sagano) for Fedora/CentOS.
6872

docs/bootc-images.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Understanding "bootc compatible" images
2+
3+
At the current time, it does not work to just do:
4+
```
5+
FROM fedora
6+
RUN dnf -y install kernel
7+
```
8+
or
9+
```
10+
FROM debian
11+
RUN apt install kernel
12+
```
13+
14+
And get an image compatible with bootc. Supporting this
15+
is an eventual goal, however there are a few reasons why
16+
this doesn't yet work. The biggest reason is SELinux
17+
labeling support; the underlying ostree stack currently
18+
handles this and requires that the "base image"
19+
have a pre-computed set of labels that can be used
20+
for any derived layers.
21+
22+
# Building bootc compatible base images
23+
24+
As a corollary to this, the build process
25+
for generating base images currently requires running
26+
through ostree tooling to generate an "ostree commit"
27+
which has some special formatting in the base image.
28+
29+
However, the ostree usage is an implementation detail
30+
and the requirement on this will be lifted in the future.
31+
32+
For example, the [rpm-ostree compose image](https://coreos.github.io/rpm-ostree/container/#creating-base-images)
33+
tooling currently streamlines this, operating just
34+
on a declarative input and writing to a registry.
35+
36+
This is how the [Project Sagano](https://gitlab.com/CentOS/cloud/sagano)
37+
base images are built.
38+
39+
# Deriving from existing base images
40+
41+
However, it's important to emphasize that from one
42+
of these specially-formatted base images, every
43+
tool and technique for container building applies!
44+
In other words it will Just Work to do
45+
```
46+
FROM <bootc base image>
47+
RUN dnf -y install foo && dnf clean all
48+
```
49+
50+
## Using the `ostree container commit` command
51+
52+
As an opt-in optimization today, you can also add `ostree container commit`
53+
as part of your `RUN` invocations. This will perform early detection
54+
of some incompatibilities.
55+
56+
However, its usage is not and will never be strictly required.
57+
58+

0 commit comments

Comments
 (0)