|
| 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